Skip to content

mock-end/random-file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

random-file

Return random file name with random extension.

MIT License

build:? coverage:?

Install

$ npm install --save random-file 

Usage

var randomFile = require('random-file');
  
// API
// - randomFile([options]);
  
// options
// - extension
// - extensions
// - fileType

By default, returns random file name with random extension:

randomFile();
// => 'bappada.amf'

Optionally specify the file extension:

randomFile({ extension: 'txt' });
// => 'tavnamgi.txt'

randomFile({ extensions: ['txt', 'md', 'doc'] });
// => 'ralve.doc'

randomFile({ 
    extensions: {
        'images': [ 'bmp', 'gif', 'png' ],
        'vector': [ '3dv', 'amf', 'awg', 'ai' ]
    } 
});
// => 'jeasmov.amf'

Optionally specify the file type, available types are:

  • raster

    ['bmp', 'gif', 'gpl', 'ico', 'jpeg', 'psd', 'png', 'psp', 'raw', 'tiff']
  • vector

    ['3dv', 'amf', 'awg', 'ai', 'cgm', 'cdr', 'cmx', 'dxf', 'e2d', 'egt', 'eps', 'fs', 'odg', 'svg', 'xar']
  • 3d

    ['3dmf', '3dm', '3mf', '3ds', 'an8', 'aoi', 'blend', 'cal3d', 'cob', 'ctm', 'iob', 'jas', 'max', 'mb', 'mdx', 'obj', 'x', 'x3d']
  • doc

    ['doc', 'docx', 'dot', 'html', 'xml', 'odt', 'odm', 'ott', 'csv', 'rtf', 'tex', 'xhtml', 'xps']
randomFile({ fileType: '3d' });
// => 'mappos.max'

Related

Contributing

Pull requests and stars are highly welcome.

For bugs and feature requests, please create an issue.

About

Return random file name with random extension.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published