convert-filename-ja

1.0.3 • Public • Published

convert-filename-ja

Build Status Coverage Status Maintainability npm version MIT License

Convert a string to be able to use as a filename with Japanese characters.

Install

npm install convert-filename-ja

Usage

convert returns a string to safe use for filename.

  • Remove control characters (0x00–0x1f and 0x80–0x9f)
  • Remove reserved filenames on UNIX/Windows
    • '.'
    • '..'
    • 'con', 'prn', 'aux', 'nul'
    • 'com1', 'com2', 'com3', 'com4', 'com5', 'com6', 'com7', 'com8', 'com9'
    • 'lpt1', 'lpt2', 'lpt3', 'lpt4', 'lpt5', 'lpt6', 'lpt7', 'lpt8', 'lpt9'
    • Remove prefix space and suffix space and dot
  • Convert reserved characters ( / ? < > ¥ \ : * | " ) to Japanese double byte characters.
  • Remove characters over 255
const converter = require('convert-filename-ja');
 
const parentDir         = converter.convert('..'); // ''
const convertDoublebyte = converter.convert('filename<2018/06/08>.txt.'); // 'filename<2018/06/08>.txt'
const nonProcessed      = converter.convert('filenme.txt'); // 'filename.txt'

Refer

https://github.com/parshap/node-sanitize-filename

Package Sidebar

Install

npm i convert-filename-ja

Weekly Downloads

2

Version

1.0.3

License

MIT

Unpacked Size

9.85 kB

Total Files

7

Last publish

Collaborators

  • ryoichi-obara