Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find specific file using b2.listFileNames return files not relevant #119

Open
XDavidT opened this issue Jan 20, 2022 · 0 comments
Open

Find specific file using b2.listFileNames return files not relevant #119

XDavidT opened this issue Jan 20, 2022 · 0 comments

Comments

@XDavidT
Copy link

XDavidT commented Jan 20, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant