Skip to content

Holixus/nano-sched-fs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gitter NPM version Build status Test coverage Dependency Status License Downloads

nano-sched-fs

Files/folders operations nano-sched plugin

File operations

data object

  • opts {Object} options object
    • sources_folder {String}
    • dist_folder {String}
  • name {String}
  • dest {String} (Optional)
  • encoding {String}
  • content {any}

load-text (log, data)

Load file from {options.sources_folder}/{data.name} to the data.content with {data.encoding}='utf8'.

load-bin (log, data)

Load file from {options.sources_folder}/{data.name} to the data.content with {data.encoding}=null.

load-json (log, data)

Load file from {options.sources_folder}/{data.name} and parse to the data.content with {data.encoding}='json'.

dont-overwrite (log, data)

Will cancels job if destination file exists.

rename (log, data)

Generate destination file name by {data.dest} template. The template can contains of shortcuts for sources file name parts:

  • \1 -- path to source name
  • \2 -- name of file
  • \3 -- extension of file

For example, for data.name = 'blah/foo.bar' and data.dest = 'folder/\2\3' will generated a new data.dest value 'folder/foo.bar'.

save (log, data)

Save data.content to {options.dist_folder}/{data.dest || data.name} with encoding {data.encoding}('utf8','json',null).

copy (log, data)

Copy file from {options.sources_folder}/{data.name} to {options.dist_folder}/{data.dest || data.name}.

Folder operations

data object

  • opts {Object} options object
    • sources_folder {String}
    • dist_folder {String}

clean-dist (log, data)

Creates or cleans {options.dist_folder}.

make-dist (log, data)

Creates(if necessary) {options.dist_folder}.

list-files (log, data)

Returns an array of all files pathes of {options.source_folder}in data.file.

About

Files/folders operations nano-sched plugin

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published