mirror of
https://github.com/HeyPuter/puter
synced 2024-11-15 06:15:47 +00:00
provide incremental directories to mkdir
This commit is contained in:
parent
4fdea7db66
commit
a646b02e45
@ -152,12 +152,16 @@ const upload = async function(items, dirPath, options = {}){
|
|||||||
// On the other hand if the file name is not blank(could be undefined), we need to create the file.
|
// On the other hand if the file name is not blank(could be undefined), we need to create the file.
|
||||||
fileName != "" && files.push(entries[i])
|
fileName != "" && files.push(entries[i])
|
||||||
if (options.createFileParent && fileItem.includes('/')) {
|
if (options.createFileParent && fileItem.includes('/')) {
|
||||||
let filePath = path.join(dirPath, dirLevel)
|
let incrementalDir;
|
||||||
// Prevent duplicate parent directory creation
|
dirLevel.split('/').forEach((directory) => {
|
||||||
if(!uniqueDirs[filePath]){
|
incrementalDir = incrementalDir ? incrementalDir + '/' + directory : directory;
|
||||||
uniqueDirs[filePath] = true;
|
let filePath = path.join(dirPath, incrementalDir)
|
||||||
dirs.push({path: filePath});
|
// Prevent duplicate parent directory creation
|
||||||
}
|
if(!uniqueDirs[filePath]){
|
||||||
|
uniqueDirs[filePath] = true;
|
||||||
|
dirs.push({path: filePath});
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// stats about the upload to come
|
// stats about the upload to come
|
||||||
|
Loading…
Reference in New Issue
Block a user