本文整理汇总了TypeScript中q-io/fs.list函数的典型用法代码示例。如果您正苦于以下问题:TypeScript list函数的具体用法?TypeScript list怎么用?TypeScript list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了list函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getDirs
function getDirs(src:string):Q.Promise<string[]> {
src = path.resolve(src);
var ret:string[] = [];
var d:Q.Deferred<string[]> = Q.defer();
FS.list(src).then((names:string[]) => {
return Q.all(names.map((name:string) => {
return FS.isDirectory(path.join(src, name)).then((isDir:boolean) => {
if (!isDir) {
return;
}
ret.push(name);
});
}));
}).then(() => {
d.resolve(ret);
}, d.reject);
return d.promise;
}
示例2:
//TODO how to define the multiple return types? use any for now?
anyQ = fs.read(path, options);
//strQ = fs.read(path, options);
//fs.read(path, options):Q.Promise<NodeBuffer>;
voidQ = fs.write(path, buffer, options);
voidQ = fs.write(path, str, options);
voidQ = fs.append(path, buffer, options);
voidQ = fs.append(path, str, options);
voidQ = fs.copy(source, target);
voidQ = fs.copyTree(source, target);
strArrQ = fs.list(path);
strArrQ = fs.listTree(path, (path, x) => {
return true;
});
strArrQ = fs.listDirectoryTree(path);
voidQ = fs.makeDirectory(path, str);
voidQ = fs.makeDirectory(path, num);
voidQ = fs.makeTree(path, str);
voidQ = fs.makeTree(path, num);
voidQ = fs.remove(path);
voidQ = fs.removeTree(path);
voidQ = fs.rename(source, target);
voidQ = fs.move(source, target);