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

How do I store binary objects and streams? #70

Open
alex-jitbit opened this issue Mar 20, 2020 · 3 comments
Open

How do I store binary objects and streams? #70

alex-jitbit opened this issue Mar 20, 2020 · 3 comments

Comments

@alex-jitbit
Copy link

Can't find any info... Any help would be appreciated.

@stefanpenner
Copy link
Owner

Today, if you wanted to cache a binary object that would be as a buffer, and enabled via supportBuffer: true. I'm not really sure what it means to cache a stream to disk, can you share more?

@cmawhorter
Copy link

for streaming, i think what they're after is something like:

const readStream = createReadStream(...);
cache.set('foo', readStream).then(function() {
  // readStream was read and closed, and stream written to foo
});

// or possibly/also

readStream.pipe(cache.setStream('foo'))

and that way the contents of foo is never buffered in memory. consider the scenario where you're caching 100mb files on a server with 1g of memory. that should be possible but won't be without stream support.

you'd also need the read stream counterpart for it to be useful, e.g.: cache.getStream('foo')

@stefanpenner
Copy link
Owner

I see, that is not currently supported, but could be. Unclear if I have time to do so, but would welcome a PR.

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

3 participants