Minimal code for adding a single file

Hi
I’m just starting with the JS wrapper for IPFS.
The first action I want to do is to write a string to a file.
The simples code snippet I could figure out doing this (initialization left out) is this:

    for await (const file of ipfs.add('hello world')) {
        console.log(file);
    }

While it’s nice to be able to write multiple files at once, I find it odd and counter-intuitive that I have to use a loop even for the default case (I’d argue) of writing a single file. Or is there a way to do this which I’m missing?

The first action I want to do is to write a string to a file.

All you need to do is this: await ipfs.add('your text here');, no for-loop needed. See https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options