profile
viewpoint
Mani Maghsoudlou manidlou California full stack developer &-> mind explorer.

jprichardson/node-fs-extra 7039

Node.js: extra methods for the fs object like copy(), remove(), mkdirs()

jprichardson/node-klaw 234

A Node.js file system walker with a Readable stream interface. Extracted from fs-extra.

manidlou/node-klaw-sync 100

Node.js recursive synchronous fast file system walker

manidlou/elemon 57

live-reload Electron application during development

manidlou/dir-tree-creator 12

Simple npm like directory tree creator based on the given path

manidlou/concatjson 5

concatenated JSON streaming parser/serializer for node.js

manidlou/gh-download-count 2

Get download count of a GitHub release https://gh-download-count.herokuapp.com/

manidlou/bracks-cli 0

node.js bracks command line interface

manidlou/chartbuzz 0

React app to create simple charts quickly and easily https://manidlou.github.io/chartbuzz

manidlou/deeputil 0

tiny node.js recursive utility to deal with keys/values of deeply nested objects

startedAPSL/react-native-keyboard-aware-scroll-view

started time in 9 days

startedmrlaessig/react-native-autocomplete-input

started time in 9 days

startedannexare/Countries

started time in 10 days

startedlutangar/cities.json

started time in 10 days

Pull request review commentjprichardson/node-fs-extra

BREAKING: Error if destination wrong type for ensureLink/Symlink

 function createLink (srcpath, dstpath, callback) {     })   } -  pathExists(dstpath, (err, destinationExists) => {-    if (err) return callback(err)-    if (destinationExists) return callback(null)+  fs.lstat(dstpath, (err, stats) => {+    if (!err && stats.isSymbolicLink()) return callback(null)

This doesn't work for links (hard links) since stats.isSymbolicLink() would return false for hard links as symlinks and hard links are different types. The thing is, there is no easy way to check if a file is a hard link! One way to do that would be by checking the entire file system :exploding_head: to see if there is any file that has the same inode as the hard link since hard link and the original file have the same inodes on the file system.

I am personally not sure what would be the best approach here.

  1. We could check if dest exists and if is symlink, then throw error.
  2. Or we allow the operation proceeds which means if dest exists, a file already exists error will be thrown.

Let me know what you guys think!

RyanZim

comment created time in 17 days

pull request commentjprichardson/node-fs-extra

[breaking] copy*(): allow copying broken symlinks

@RyanZim go for it.

manidlou

comment created time in 17 days

startedant-design/ant-design

started time in 18 days

startedsocketio/socket.io

started time in 19 days

issue commentjprichardson/node-fs-extra

Move fails with EPERM when destination is in root of drive

That's actually documented (https://nodejs.org/api/fs.html#fs_fs_mkdir_path_options_callback). I would say we check the error, but if anyone thinks checking if parent is root is a better approach because of specific reasons, I am open to that!

Niquolas

comment created time in a month

delete tag manidlou/node-klaw-sync

delete tag : 6.0.0

delete time in 2 months

created tagmanidlou/node-klaw-sync

tagv6.0.0

Node.js recursive synchronous fast file system walker

created time in 2 months

created tagmanidlou/node-klaw-sync

tag6.0.0

Node.js recursive synchronous fast file system walker

created time in 2 months

release manidlou/node-klaw-sync

6.0.0

released time in 2 months

Pull request review commentjprichardson/node-fs-extra

move: support changing case in case-insensitive systems

 function move (src, dest, opts, cb) {    stat.checkPaths(src, dest, 'move', opts, (err, stats) => {     if (err) return cb(err)-    const { srcStat } = stats+    const { srcStat, isChangingCase = false } = stats     stat.checkParentPaths(src, srcStat, dest, 'move', err => {       if (err) return cb(err)       mkdirp(path.dirname(dest), err => {         if (err) return cb(err)-        return doRename(src, dest, overwrite, cb)+        return doRename(src, dest, overwrite, isChangingCase, cb)       })     })   }) } -function doRename (src, dest, overwrite, cb) {+function doRename (src, dest, overwrite, isChangingCase, cb) {   if (overwrite) {     return remove(dest, err => {

I verified that on Mac, but it doesn't hurt to have a test for it!

manidlou

comment created time in 2 months

startedsharanda/manrope

started time in 2 months

push eventjprichardson/node-fs-extra

Mani Maghsoudlou

commit sha cdfe6e870f5f47e46a416337d2911ef1df34d554

check changing case before checking overwrite

view details

push time in 2 months

Pull request review commentjprichardson/node-fs-extra

move: support changing case in case-insensitive systems

 function move (src, dest, opts, cb) {    stat.checkPaths(src, dest, 'move', opts, (err, stats) => {     if (err) return cb(err)-    const { srcStat } = stats+    const { srcStat, isChangingCase = false } = stats     stat.checkParentPaths(src, srcStat, dest, 'move', err => {       if (err) return cb(err)       mkdirp(path.dirname(dest), err => {         if (err) return cb(err)-        return doRename(src, dest, overwrite, cb)+        return doRename(src, dest, overwrite, isChangingCase, cb)       })     })   }) } -function doRename (src, dest, overwrite, cb) {+function doRename (src, dest, overwrite, isChangingCase, cb) {   if (overwrite) {     return remove(dest, err => {

Yeah I see your point! It is safer to check changing case before checking overwrite. However, I don't understand what would be the point of using overwrite: true when you just want to change the case!

Basically, the overwrite: true is useful when there is a possibility (or we know for sure) that dest already exists and we want to move src to dest regardless. In this case, we are dealing with 2 files and overwrite: true is needed in order to get the desired result. But, when we are just changing the case, we are basically dealing with 1 file, so there is no need to use the overwrite option!

manidlou

comment created time in 2 months

startednodemailer/nodemailer

started time in 2 months

startedgoogleapis/nodejs-storage

started time in 2 months

startedreact-native-community/react-native-modal

started time in 2 months

startedUnitech/pm2

started time in 2 months

pull request commentjprichardson/node-fs-extra

move: support changing case in case-insensitive systems

I verified that on Mac and it successfully changed the case.

manidlou

comment created time in 3 months

startedssllabs/research

started time in 3 months

startedhelmetjs/helmet

started time in 3 months

startedcertbot/certbot

started time in 3 months

startedGeekyAnts/NativeBase

started time in 3 months

pull request commentjprichardson/node-fs-extra

move: support changing case in case-insensitive systems

@RyanZim that's definitely required and I wanted to do that but I don't have neither of those systems. I appreciate if anyone could verify that on Mac and Windows! Feel free to let me know if the changes don't work and I will work on it then! I also might be able to have access to my friend's macbook tomorrow, so I'll let you know then.

manidlou

comment created time in 3 months

create barnchjprichardson/node-fs-extra

branch : mani/move-case-insensitive

created branch time in 3 months

delete branch jprichardson/node-fs-extra

delete branch : mani/copy-err-msg

delete time in 3 months

push eventjprichardson/node-fs-extra

Mani Maghsoudlou

commit sha 35b078e9d52105dc287d2dc9a2a1e5de8a7b152e

copy*(): throw err if src and dest are not the same type

view details

Mani Maghsoudlou

commit sha 3de2b162a8ff6c011ab3e1a075e0640ab4bb988c

copy*(): allow copying broken symlinks

view details

Mani Maghsoudlou

commit sha ff83f16cd692a109fb59bcb0a9136666474ede9b

bring back deleted move tests

view details

Mani Maghsoudlou

commit sha 403060c780074baf1e49d55997386f9b05c02dc7

Merge pull request #779 from jprichardson/mani/copy-err-msg copy: allow copying broken symlinks

view details

push time in 3 months

PR merged jprichardson/node-fs-extra

Reviewers
[breaking] copy*(): allow copying broken symlinks feature-copy

Fixes #765, fixes #638, fixes #761.

+211 -134

8 comments

20 changed files

manidlou

pr closed time in 3 months

create barnchjprichardson/node-fs-extra

branch : v10

created branch time in 3 months

more