New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sanitize-s3-objectkey

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sanitize-s3-objectkey

Remove and replace illegal characters in S3 Object Keys

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

sanitize-s3-objectkey

0 dependencies library to sanitize S3 object keys.

Motivation

You can use any UTF-8 character in an S3 object key name. However, using certain characters in key names may cause problems with some applications and protocols (source). This library applies some conversions on the provided object key to help mitigate these problems.
In particular:

  • spaces at the beginning and end of the string are removed
  • spaces inside the string are replaced by a (configurable) separator
  • accents from latin characters are removed
  • illegal characters are removed

This project is heavily inspired by s3-filename.

Installation

npm install sanitize-s3-objectkey

Usage

const sanitize = require('sanitize-s3-objectkey');

sanitize('áêīòü'); // aeiou
sanitize('pipes|are|not|valid'); // pipesarenotvalid
sanitize('spaces should be replaced'); // spaces-should-be-replaced
sanitize('spaces should be replaced', '/'); // spaces/should/be/replaced

Contributing

Feedback, bug reports, and pull requests are welcome.

For pull requests, make sure to follow the following guidelines:

  • Add tests for each new feature and bug fix.
  • Follow the existing code style, enforced by eslint.
  • Separate unrelated changes into multiple pull requests.

License

Apache License 2.0, see LICENSE.

Keywords

FAQs

Package last updated on 11 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc