juliangruber / juliangruber/stream
Buffer File to store as a Pdf into Google Cloud storage
- Dominant language
- HTML
- Stars
- 67
- Forks
- 33
- PR merge metrics
- No merged PRs in 30d
Description
If I need to store a a pdf to google cloud storage, the below code works fine.
```
var {Storage} = require('@google-cloud/storage');
const gcs = new Storage({
projectId: 'projectId',
keyFilename: 'xyz.json'
});
const bucket = gcs.bucket('projectId');
var localReadStream = fs.createReadStream('path/to/new.pdf');
var Pdf = bucket.file('newFile.pdf');
localReadStream.pipe(Pdf.createWriteStream({
metadata: {
contentType: 'application/pdf',
metadata: {
custom: 'metadata'
}
}
}))
```
But I do have a buffer object of this file pdf file as ` {
// Something
});
```
But not able to figure it out how to do the pipe operation. Any help would be appreciated.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.