yakovkhalinsky/backblaze-b2

Find specific file using b2.listFileNames return files not relevant

XDavidT opened this issue · 0 comments

I uploaded some files, delete some and so on, after my B2 was empty from files at all, I ask wanted to get a specific file, by file name, using the function b2.listFileNames and got a file that did not exists, also the name wasn't match.
And no, the name wasn't matched in any part of it, my file name is hash of text, so the hash was completely different.
How can I avoid this issue and why does it's happening?
Right now I made something like this, but it's feel wrong:

        const getFiles = await b2.listFileNames({
            bucketId: <bucket-id>,
            maxFileCount:2,
            startFileName:filename
        })
        for(let file of getFiles.data.files){
           if(file.fileName === filename){
               return b2Config.getFileURL + file.fileId
           }
        }

I don't want to find all files, I want specific file. Is there any option to query specific one?