You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.
I am trying to upload images in an archive as readable streams but keep receiving error 500s back in reddit's response. Am I incorrectly using the uploadStylesheetImage method? As an alternative, I am currently uncompressing the images into a temp directory then removing that directory after the file uploads are complete. How would I stream the images from the archive to the uploadStylesheetImage method?
constrestoreStylesheetImage=(r,subreddit,stylesheetImage)=>{const[name,imageType]=stylesheetImage.name.split('.');conststrim=newstream.PassThrough();strim.end(stylesheetImage.data);// stylesheetImage.data is an image as type Node.js Bufferr.getSubreddit(subreddit).uploadStylesheetImage({
name,
imageType,file: strim,}).catch(console.error);};
The text was updated successfully, but these errors were encountered:
Well, you could probably accumulate the stream into a buffer, and then use the workaround to send the buffer (which would have known length at that point). That does lose some of the advantages of using a stream, but it will probably be faster than writing to the filesystem, and it won't leave files around if something crashes.
Since the solution proposed by not-an-aardvark seems to work I'm going to go ahead and close this due to inactivity. If you want to reopen the ticket just make a comment and I'll open it.
I am trying to upload images in an archive as readable streams but keep receiving error 500s back in reddit's response. Am I incorrectly using the
uploadStylesheetImage
method? As an alternative, I am currently uncompressing the images into a temp directory then removing that directory after the file uploads are complete. How would I stream the images from the archive to theuploadStylesheetImage
method?The text was updated successfully, but these errors were encountered: