added directory snapshot
This commit is contained in:
13
README.md
13
README.md
@@ -102,6 +102,19 @@ await api.directory.list('/', async (remote_path, page_count, get_page) => {
|
||||
}
|
||||
});
|
||||
|
||||
// Asynchronous directory list
|
||||
const snap = await api.directory.snapshot('/');
|
||||
try {
|
||||
for (let i = 0; i < snap.page_count; i++) {
|
||||
const items = await snap.get_page(i); // Always 'await'
|
||||
console.log(items);
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
} finally {
|
||||
await snap.release();
|
||||
}
|
||||
|
||||
// Create new directory
|
||||
await api.directory.create('/test');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user