How to use fs-capacitor - 1 common examples

To help you get started, we’ve selected a few fs-capacitor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qmit-pro / moleculer-api / src / schema / plugin / protocol / rest / handler / multipart.ts View on Github external
parser.on("file", (fieldname, stream, filename, encoding, mimetype) => {
        if (exitError) {
          this.wasteStream(stream);
          return;
        }

        currentStream = stream;
        stream.on("end", () => {
          currentStream = undefined;
        });

        // create buffer stream
        const capacitor = new WriteStream();

        capacitor.on("error", () => {
          stream.unpipe();
          stream.resume();
        });

        stream.on("error", error => {
          stream.unpipe();
          capacitor.destroy(error);
        });

        stream.on("limit", () => {
          stream.unpipe();
          capacitor.destroy(new Error(`file ${filename} exceeds the ${this.props.maxFileSize} byte size limit`)); // TODO: normalize error
        });

fs-capacitor

Filesystem-buffered, passthrough stream that buffers indefinitely rather than propagate backpressure from downstream consumers.

MIT
Latest version published 2 years ago

Package Health Score

62 / 100
Full package analysis

Popular fs-capacitor functions