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.
|
||||
fileName != "" && files.push(entries[i])
|
||||
if (options.createFileParent && fileItem.includes('/')) {
|
||||
let filePath = path.join(dirPath, dirLevel)
|
||||
let incrementalDir;
|
||||
dirLevel.split('/').forEach((directory) => {
|
||||
incrementalDir = incrementalDir ? incrementalDir + '/' + directory : directory;
|
||||
let filePath = path.join(dirPath, incrementalDir)
|
||||
// Prevent duplicate parent directory creation
|
||||
if(!uniqueDirs[filePath]){
|
||||
uniqueDirs[filePath] = true;
|
||||
dirs.push({path: filePath});
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
// stats about the upload to come
|
||||
|
Loading…
Reference in New Issue
Block a user