Popularity
3.4
Growing
Activity
4.2
Declining
258
9
14

Monthly Downloads: 0
Programming language: JavaScript
License: MIT License
Tags: Filesystem     String     Path     Filepath     Sanitize     File     Name     Convert     Dirname     Valid     Safe     Filename    
Latest version: v4.1.0

filenamify alternatives and similar modules

Based on the "Filesystem" category

Do you think we are missing an alternative of filenamify or a related project?

Add another 'Filesystem' Module

README

filenamify Build Status

Convert a string to a valid safe filename

On Unix-like systems / is reserved and <>:"/\|?* on Windows.

Install

$ npm install filenamify

Usage

const filenamify = require('filenamify');

filenamify('<foo/bar>');
//=> 'foo!bar'

filenamify('foo:"bar"', {replacement: '🐴'});
//=> 'foo🐴bar'

API

filenamify(string, [options])

Convert a string to a valid filename.

filenamify.path(path, [options])

Convert the filename in a path a valid filename and return the augmented path.

options

Type: Object

replacement

Type: string Default: '!'

String to use as replacement for reserved filename characters.

Cannot contain: < > : " / \ | ? *

maxLength

Type: boolean Default: 100

Truncate the filename to the given length.

Systems generally allow up to 255 characters, but we default to 100 for usability reasons.

License

MIT © Sindre Sorhus


*Note that all licence references and agreements mentioned in the filenamify README section above are relevant to that project's source code only.