1.0.2 • Published 8 years ago

nano-sched-file v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

Gitter NPM version Build status Test coverage Dependency Status License Downloads

nano-sched-file

File operations nano-sched plugin

data object

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

file.load (log, data)

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

file.load-bin (log, data)

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

file.dont-overwrite (log, data)

Will cancels job if destination file exists.

file.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'.

file.save (log, data)

Save data.content to <options.dist_folder>/<data.dest || data.name> with encoding <data.encoding>.

file.copy (log, data)

Copy file from <options.sources_folder>/<data.name> to <options.dist_folder>/<data.dest || data.name>.

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago