carp-streamer
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -304,9 +304,14 @@ "use strict"; | ||
return __asyncGenerator(this, arguments, function* listDirectoryEntriesRecursively_1() { | ||
for (let dirent of yield __await(readdir(root, { withFileTypes: true }))) { | ||
const entryPath = path_1.default.join(root, dirent.name); | ||
yield yield __await(({ path: entryPath, dirent })); | ||
if (dirent.isDirectory()) { | ||
yield __await(yield* __asyncDelegator(__asyncValues(listDirectoryEntriesRecursively(entryPath)))); | ||
try { | ||
for (let dirent of yield __await(readdir(root, { withFileTypes: true }))) { | ||
const entryPath = path_1.default.join(root, dirent.name); | ||
yield yield __await(({ path: entryPath, dirent, error: null })); | ||
if (dirent.isDirectory()) { | ||
yield __await(yield* __asyncDelegator(__asyncValues(listDirectoryEntriesRecursively(entryPath)))); | ||
} | ||
} | ||
} | ||
catch (error) { | ||
yield yield __await({ path: root, dirent: null, error }); | ||
} | ||
}); | ||
@@ -313,0 +318,0 @@ } |
@@ -76,6 +76,10 @@ #!/usr/bin/env node | ||
var e_1, _a; | ||
const q = async_1.default.queue(({ path: absolutePath, dirent }, done) => __awaiter(this, void 0, void 0, function* () { | ||
const q = async_1.default.queue(({ path: absolutePath, dirent, error }, done) => __awaiter(this, void 0, void 0, function* () { | ||
const relativePath = path_1.default.relative(rootPath, absolutePath); | ||
if (error) { | ||
spinner.warn(`Could not access '${relativePath}'.`); | ||
return done(error); | ||
} | ||
if (excludes.some(exclude => absolutePath.startsWith(exclude))) { | ||
spinner.succeed(`'${relativePath}' has been excluded.`); | ||
spinner.info(`'${relativePath}' has been excluded.`); | ||
return done(); | ||
@@ -82,0 +86,0 @@ } |
{ | ||
"name": "carp-streamer", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "Carp streamer", | ||
@@ -5,0 +5,0 @@ "bin": "dist/index.js", |
@@ -234,10 +234,14 @@ import BoxSDK from 'box-node-sdk'; | ||
const readdir = util.promisify(fs.readdir); | ||
export async function* listDirectoryEntriesRecursively(root: string): AsyncIterableIterator<{path: string, dirent: fs.Dirent}> { | ||
for(let dirent of await readdir(root, { withFileTypes: true })) { | ||
const entryPath = path.join(root, dirent.name); | ||
yield ({ path: entryPath, dirent }); | ||
if (dirent.isDirectory()) { | ||
yield* listDirectoryEntriesRecursively(entryPath); | ||
export async function* listDirectoryEntriesRecursively(root: string): AsyncIterableIterator<{path: string, dirent: fs.Dirent | null, error:any}> { | ||
try { | ||
for(let dirent of await readdir(root, { withFileTypes: true })) { | ||
const entryPath = path.join(root, dirent.name); | ||
yield ({ path: entryPath, dirent, error: null }); | ||
if (dirent.isDirectory()) { | ||
yield* listDirectoryEntriesRecursively(entryPath); | ||
} | ||
} | ||
} catch (error) { | ||
yield { path: root, dirent: null, error}; | ||
} | ||
} |
@@ -63,6 +63,10 @@ #!/usr/bin/env node | ||
client.folders.get(destination).then(async (rootFolder) => { | ||
const q = async.queue(async ({ path: absolutePath, dirent }, done) => { | ||
const q = async.queue(async ({ path: absolutePath, dirent, error }, done) => { | ||
const relativePath = path.relative(rootPath, absolutePath); | ||
if (error) { | ||
spinner.warn(`Could not access '${relativePath}'.`); | ||
return done(error); | ||
} | ||
if (excludes.some(exclude => absolutePath.startsWith(exclude))) { | ||
spinner.succeed(`'${relativePath}' has been excluded.`); | ||
spinner.info(`'${relativePath}' has been excluded.`); | ||
return done(); | ||
@@ -69,0 +73,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68455
1081