Module: FileUtils
Instance Method Summary collapse
- #chmod(mode, file_list) ⇒ Object
- #cp(source, target) ⇒ Object
- #mkdir_p(path) ⇒ Object (also: #mkpath, #makedirs)
- #mv(source, target) ⇒ Object
- #rm(path) ⇒ Object
Instance Method Details
#cp(source, target) ⇒ Object
12 13 14 15
# File 'opal/stdlib/nodejs/fileutils.rb', line 12 def cp source, target target = File .join (target, File .basename(source)) if File .directory? target `__fs__.writeFileSync(target, __fs__.readFileSync(source));` end
#mkdir_p(path) ⇒ Object Also known as: mkpath, makedirs
21 22 23 24
# File 'opal/stdlib/nodejs/fileutils.rb', line 21 def mkdir_p path return true if File .directory? path `__fs__.mkdirSync(#{path})` end
#mv(source, target) ⇒ Object
29 30 31 32
# File 'opal/stdlib/nodejs/fileutils.rb', line 29 def mv source, target target = File .join (target, File .basename(source)) if File .directory? target `__fs__.renameSync(source, target)` end
#rm(path) ⇒ Object
17 18 19
# File 'opal/stdlib/nodejs/fileutils.rb', line 17 def rm path `__fs__.unlinkSync(path)` end