Skip to content

Getting Files backed up by the filesystem #37340

Closed as not planned
Closed as not planned
@jimmywarting

Description

@jimmywarting

Is your feature request related to a problem? Please describe.
Blobs are merely pretty useless if they can only be constructed and held in memory.
A way to get blobs from the filesystem is necessary if we should see any use for them
I propose we add support for getting blob's from the filesystem before we start adding support for them in other places like the crypto, streams, fs and other place

After all writing a blob back to the filesystem can be as easy as creating a stream and piping it back to the filesystem or to a http request

Describe the solution you'd like

fs.promises.getBlob('./4gb.dat') // just so we can start using the blob
fs.promises.getFile('./4gb.dat') // think this requires a File class

// It should not be a issue to get a blob sync, the data should not be held in memory anyway
// the only thing that should be read is modified time and the file size (and filename for `.getFile()`)
// it should only be a pointer to where it should read the data from ( like a handle )
fs.getBlobSync('./4gb.dat')

if the modified time is changed when you try to read the blob then it should throw a NotReadableError DOMException saying that it's out of sync. Likewise if size is changed.

Describe alternatives you've considered
fetch-blob has a "BlobDataItem" that is backed up by the filesystem...


assume this depends somewhat on #37338 and #39015 being resolved first

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.fsIssues and PRs related to the fs subsystem / file system.stale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions