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 🙏

© 2025 – Pkg Stats / Ryan Hefner

uploader-go-bucket

v1.5.0

Published

Upload local files, then sent file local from s3 bucket

Downloads

57

Readme

Node Module uploader-go-bucket

Installation

$ npm install uploader-go-bucket

Require modules

let uploader = require('uploader-go-bucket'),
    s3Helper = uploader.s3Helper({ bucket: 'YOUR_BUCKET_NAME' });

Simple Example

Note: if you use windows, install the program 'gitBash' that emulate the command line, is you use mac ou linux "YOU IS HAPPY"

Download this project by .zip, then unzip, and run in command line, in this steps:

Go to the directory wirh unziped files

$ cd uploader-go-bucket-master

Run npm

$ npm install

Go to the 'public' directory, and run node server

$ cd public/ && node server

Available Methods

uploader

  • params: The configuration of own formidable module
    • uploadDir: (required) The path local when the file gona be stored
  • req: The 'request' of express module, to set in parse of formidable
uploader
.uploader({uploadDir: './public/upload/'}, req)
.then(file=>{
    console.log(file); // the uploaded file
    // sent to your s3 bucket
}, err => {
    console.log(err);
});

s3Helper

The instance with the configuration of the bucket

  • options: (default {bucket:''}) The options of configuration for bucket, only the bucket name in the moment

s3Helper Methods

  • uploadObject: The method to uplaod file local from s3 Bucket
  • deleteObject: The method to delete and list of objects fro Bucket
  • listObject: Get a list of objects from s3 Bucket
  • getObject: Get a specific object by your Key from s3 Bucket

uploadObject

  • file: The object of uploaded file
  • pathName: The name of the key to sent from s3
  • newPathName: The path of the local file to upload from bucket
  • everDelete: (default true) option to delete local file when is sent to bucket
// with help in the example above
s3Helper
.uploadObject(file, `myFirstTest/${file.name}`, file.path)
.then(data=>{
    // put here your business rule
},err=>{
    console.log(err);
});

deleteObject

Delete an Object from bucket s3, in the default bucket

  • Keys: Array of object with the keys path which will be deleted
s3Helper
.deleteObject([
    {Key: 'PARH_KEY_BUCKET'}
])
.then(data =>
{
    // put here your business rule
    console.log(data);
}, err => {
    console.log(err);
})

listObject

List the Objects from bucket s3 by key informed in argument, in the default bucket

  • Key: the path of object in Bucket
s3Helper
.listObject('myFirstTest/')
.then( data => {
   // put here your business rule
   console.log(data);
}, err => {
    console.log(err);
});

getObject

Get an Object from bucket s3, in the default bucket

  • Keys: array of object with the keys path which will be deleted
s3Helper
.getObject(`myFirstTest/${file.name}`)
.then(item => {
    // put here your business rule
    console.log(item);
}, err => {
    console.log(err);
});

manageObject

Method to manage the images in bucket s3, remove from bucket all imagens that not equal to the image param informed

  • path: the base path of the object in the bucket
  • image: The Object with current image data to be keep
  • postImage: The Object with image data sent in the request post
  • sessionImage: The Object with image data store in the session
s3Helper
.manageObject(
     `myFirstTest/${user._id}`, // the base path
     {
        "size": "(int) size of image", 
        "path": "(string) new name", 
        "name": "(string) original name", 
        "type":"(string)image/png"
     }, the cuttent imagen
     null, // post data
     null // session data
)
.then(promisses => {
    // put here your business rule
    console.log(promisses);
}, errors => {
    console.log(errors);
});