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

s3-check-rename

v0.1.0

Published

Clean the file name check if the name exists in S3 bucket and if the name exists add a index to the name to avoid override the file.

Downloads

6

Readme

#S3 Check and Rename

This module provide a way to clean the filename and check if the name of the file exists in a S3 Bucket and provide a alternative name if the file exists to avoid override.

To clean the name the module remove the odd characters and spaces.

The alternative name add a increasing index in the end of the filename if the filename exists.

#####Ejem:#####

"crème brûlée.png" will be rename to "creme-brulee.png" if the file doesn't exist but if the file exists will be rename to "creme-brulee-0.png".

###Requirements### This module use aws-sdk package to get the bucket info for this we need create a folder called .aws in the home directory of our machine and put the AWS credentials file in the folder.

###How to use###

This module is helpful to use with sails.js s3-skipper module to upload files to amazon and maintain a better name more close to the original name. The example is a modification of FileController.js on sails 101 examples.

function(req, res) {
	var S3CR = require('s3-check-rename'),
	s3CRename = new S3CR('bucketName'),
	upload = req.file('avatar')._files[0].stream,
	originalName = upload.filename;
	
	s3CRename.check(originalName, function(err, name){
	req.file(req.param('id')).upload(
        {
          saveAs: name,
          adapter: require('skipper-s3'),
          bucket: 'bucketName',
          key: "aws key",
          secret: "aws secret"
        }, function whenDone(err, uploadedFiles) {
          if (err) return res.serverError(err);
          else return res.json({
            files: uploadedFiles,
            textParams: req.params.all()
          });
        });
	});
}

Release History

  • 0.1.0 Initial release