Binary Data write only if new or deleted item in json

I am loading my entire spotify library every 2 minutes and I would like to avoid to have to rewrite the entire binary file each time, I would like to rewrite the file only if a new item is added or deleted, but I can’t figure it out
Attached is a partial workflow

Hey @LightD31,

Welcome to the community :raised_hands:

What I would maybe to is read the binary file at the start then use the merge node to work out what is in the Spotify results but not in the binary file that will then give you the list of things to process. We have a neat blog post that covers the theory using other applications here: How to synchronize data between two systems

The other option would be to check if the Spotify has an added date if it does as you know the time you run your workflow you could check to see if the added date is after now - 2 minutes this can be done with the date and time node and an if node.

I think as you mentioned deletions as well though the first approach might be better but it depends on if the deletion can happen both ways.

I am not sure if you have seen them but we do have some good examples of doing things with Spotify that have been submitted by community members like this one: https://n8n.io/workflows/1074 maybe you can find something there that is similar to what you are after as well.