Uploading large tiff files in nodejs - node.js

I am developing a web app using MEAN Stack and Angular 6. I want to upload tiff files(maps) with large file size.(max size is around 1.4 GB).I used 'ng2fileUpload' and 'multer' for that but it does not allow to store large files. Is there any good method to use for uploading large files in nodejs. My preavious post is on this link. 'Uploading files using multer gives 'request entity too large' error'

You should check first if there is a limit on max upload on the server site instead of the client side. There is a limit with apache service.

Related

Converting heic/heif to jpg in react native (or nodejs)

I have a react native app on ios where users can upload photos. I resize these photos server-side with sharp. The problem is:
the HEIC/HEIF-files from ios are not compatible with sharp. I get the following error:
¡Error: source: bad seek to 2808991
heif: Unsupported feature: Unsupported codec (4.3000)
¿
Is there a way to get a JPG version of the photo? It's also ok if I have to convert the file to jpg on the server, but how can I detect the codec of the image (so that only HEIC/HEIF images are converted, and not jpg or png)?
How can I convert them client side or server side?
React Native Image Resizer can perform HEIC to jpeg compression on the app. It's a native module so you'll have to build a development client if you're using expo.

Process files from postman or UI in Node JS, without storing them in local storage

I am using multer npm library to read files from postman and I am getting the file and its details in my node js code(checked via logging req.file), but my concern is I don't want the file to get stored in my local machine, I just want to extract the data from the file and process further for my requirements.
Is this possible or anyone can suggest me some solutions to this.
Thanks in advance
As I read multer libraries, it streams the uploaded file in the disk, and then it processes the file.
If you only want to use the properties like mime/type or originalfilename of the file you can use multer and in the storage options after getting the uploaded file properties, use cb(null, false) to prevent storing the file, but if you want to process the file, you can remove it from the disk after your process is done.

Jimp write image to Google cloud storage node js

I'm currently writing images to my filesystem using jimp.
For example: image.write('path')
This cannot be used on Google App Engine because its read only filesystem.
How can I write this to a Google storage bucket? I've tried writestreams but keep getting read only errors so I feel like jimp is still writing to the drive.
Thanks heaps
As I can understand you are modifying some images on your App Engine and you want to upload them to a bucket but you didn't mention if you are using standard or flex environment. In order to do this you want to make your publicly readable so it can serve files.
Following this Google Cloud Platform Node.js documentation you can see that to upload a file to a bucket you need to create object first using:
const blob = bucket.file(yourFileName);
Then using createWriteStream you can upload the file

TypeError: storage._handleFile is not a function

I want to retrieve an image from the mongodb database using nodejs and mongoose as a ORM. I got this error when i was trying to retreive image from database. I have used multer-gridfs-storage for storing the image to mongodb
Hard to tell but you're probably using:
{ storage: { storage: diskStorage(...) }}
It should be
{ storage: diskStorage(...) }
Just a little developer tip mate, using multer-gridfs-storage you can upload the whole image into the data base . That means the database will be very heavy in a little time. So let's say after a quite a long time you will need to make a backup. So the backup time will be massive mate.
So my recommendation is that you use multer - npm. Just multer because using that you can still upload the image but not to the database. Instead you can store the image into your server by creating a dedicated folder for all your image and upload all incoming images there. To reference the image into a certain object, you can store the image name instead of the whole image. Thus the database size will be not increased rapidly

Upload filestream to cloud-files with Node.js

I know that it's possible to upload files to my cloud-files account in Node.js, using the following module: node-cloudfiles.
But is it also possible to upload a filestream directly?
In my case I am dowloading an image from a certain location in Node.js and want to upload this directly to my cloud-files account without saving the image temporary on my server.
Of course it is possible - you can just read the documentation on Rackspace Cloud Files API ( http://docs.rackspacecloud.com/files/api/cf-devguide-latest.pdf ) and implement the necessary parts yourself.
However, I'd suggest to wait until https://github.com/nodejitsu/node-cloudfiles/pull/11 gets integrated into the trunk - then node-cloudfiles library will support uploading files using streams so you won't have to create files before uploading.

Resources