fluent-file
v0.2.2
Published
A fluent TypeScript library for working with files and folders
Downloads
30
Readme
Fluent File
A fluent TypeScript library for working with files and folders
FluentFolder
Fields:
path: the absolute path to this folder (/tmp/example/someFolder)name: the last piece of the absolute path (someFolder)info: an object with bothpathandname
Methods:
stats()exists()ensureExists()ensureEmpty()remove()findFolders()findFiles()
Transform methods:
file(): createFluentFileby resolving the path from thisFluentFolderfolder(): createFluentFolderby resolving the path from thisFluentFolder
FluentFile
Fields:
path: the absolute path to this file (/tmp/example/someFolder/someFile.txt)folderPath: the absolute path to the folder this file is in (/tmp/example/someFolder)info: an object withabsolutePath,folderPath,name,basenameandext
Getters/setters (call without arg to get, call with arg to set):
name: the name of the file with the extension (someFile.txt)basename: the name of the file without the extension (someFile)ext: the file extension without the leading dot. (txt)
Schema methods:
schema(): create newFluentFileinstance with a Standard Schema
Info methods:
stats()callsnode:fs/promises.stat()exists()ensureExists()
Move/remove methods:
copyTo()moveTo()linkTo()symlinkTo()remove()
Read methods:
readText()readBuffer()read(): makes use of this file'sschemato parse then validate the file contentscreateReadStream()
Write methods:
append()writeText()writeBuffer()write(): makes use of this file'sschemato validate then stringify the file contentscreateWriteStream()
Image methods:
Uses sharp library
metadata()resize()toAVIF()phash(): uses sharp-phash to create a perceptual hash of the image- plus all other
sharpmethods
Video methods:
Uses ffmpeg commands
metadata(): using ffprobeextractFrame()
Transform methods:
file(): createFluentFileby resolving the path from thisFluentFilefolder(): createFluentFolderby resolving the path from thisFluentFile
