[NODE] "TypeError: file.match is not a function" when uploading

Comments

2 comments

  • Avatar
    Welltok Staging

    I'm having the same issue. Did you find any answers?

    0
    Comment actions Permalink
  • Avatar
    Anthony Pothin

    well i didn't remember my that post.

    Today i use cloudinary.uploader.upload_stream function. I had no issue with it. See below how i use it with a buffer.

    class BufferStream extends stream.Readable {
    constructor(buffer, options) {
    super(options || {});
    this.buffer = buffer;
    }
    _read(size) {
    if (this.buffer.length === 0) {
    this.push(null);
    } else {
    this.push(this.buffer.slice(0, size));
    this.buffer = this.buffer.slice(size);
    }
    }
    }

    var stream = new BufferStream(myFileBuffer);
    stream.pipe(cloudinary.uploader.upload_stream(callback));

    0
    Comment actions Permalink

Please sign in to leave a comment.