npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

busboy-file-management

v3.0.1

Published

Busboy File Management is a library for managing files on the server using Busboy, a Node.js module for analyzing multipart/form-data data.

Downloads

16

Readme

BUSBOY-FILE-MANAGEMENT

Busboy File Management is a library for managing files on the server using Busboy, a Node.js module for analyzing multipart/form-data data.

Installation:

Installation can be done using npm or yarn. run the following command: NPM:

npm install busboy-file-management

YARN:

yarn add busboy-file-management

USE:


import { BusboyFileManagement } from 'busboy-file-management'

or

const { BusboyFileManagement } = require('busboy-file-management');

EXPRESS Middlaware:

Memory Usage

upload_middlaware.js:

import { BusboyFileManagement, MemoryStorage } from 'busboy-file-management'

export default async (req: any, res: any, next: Function) => BusboyFileManagement.config({
        limits:{
            files: 5,
            fileSize: 80 * 1024 * 1024
        },
        storage: new MemoryStorage()
    }).handle(req, res, next);
}

Temporary Usage

import { BusboyFileManagement, TemporaryStorage } from 'busboy-file-management'

export default async (req: any, res: any, next: Function) => BusboyFileManagement.config({
        limits:{
            files: 5,
            fileSize: 80 * 1024 * 1024
        },
        storage: new TemporaryStorage()
    }).handle(req, res, next);
}

Local Usage

import { BusboyFileManagement, LocalStorage } from 'busboy-file-management'

export default async (req: any, res: any, next: Function) => BusboyFileManagement.config({
        limits:{
            files: 5,
            fileSize: 80 * 1024 * 1024
        },
        storage: new LocalStorage('/files')
    }).handle(req, res, next);
}

server.js:

import express from 'express';
import UploadManagement from './upload_middlaware';

const app = express();
const port = 3000;

app.use(express.json());
app.use(UploadManagement)
app.post('/upload', (req: any, res: any) => {
  console.log('Files:', req.files);
  console.log('Fields:', req.body);
  res.send('Upload successful!');
});

app.listen(port, () => {
  console.log(`Server running at http://localhost:${port}`);
});

req.files MemoryStorage data:

Files: [
  {
    fieldname: 'files',
    buffer: <Buffer 54 46 48 30 30 30 30 30 30 30 31 41 52 53 30 32 38 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 20 20 20 20 20 20 ... 8350 more bytes>,
    originalname: 'test.txt',
    encoding: '7bit',
    mimetype: 'text/plain',
    truncated: false,
    size: 8400,
    url: ''
  }
]

req.files data Temporary/Local Storage:

Files: [
  {
    fieldname: 'files',
    buffer: <Buffer 54 46 48 30 30 30 30 30 30 30 31 41 52 53 30 32 38 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 20 20 20 20 20 20 ... 8350 more bytes>,
    originalname: 'test.txt',
    encoding: '7bit',
    mimetype: 'text/plain',
    truncated: false,
    size: 8400,
    url: 'C:\\Users\XXXXX\AppData\Local\Temp\ad31f46f-f1b5-4f22-a5e7-5df6243bf1fb'
  }
]

Supported storages

| Feature | Status | | ------------- | ------------- | | MemoryStorage | ✅ | | TemporaryStorage | ✅ | | LocalStorage | ✅ |

Default settings

| setting | value | | ------------- | ------------- | | files | 1 | | fileSize | 25MB |