How to save to ipfs without pinning?

My app uses the following code to save a test image to ipfs:

    const ipfs = await IPFS.create();

    fs.readFile('./routes/test_image.jpg', async function(err, data) {

        for await (const file of await ipfs.add({

            content: Buffer.from(data)

          })) {

            const r_data = Buffer.concat(await all(

            console.log(" cid : ", file.cid.toString());

            await helper.stopIpfsNode(ipfs);



A online post says that the file is automatically pinned by the saving node. My question is that how to save to ipfs without pinning. On another words, my app wants the saved file to be in the cache and can be removed.

Set the pin option to false when adding -