download
raw
534 Bytes
const { dirname, resolve } = require('path');
const { readdir, stat } = require('fs');
const { promisify } = require('util');
const toStats = promisify(stat);
const toRead = promisify(readdir);
module.exports = async function (start, callback) {
let dir = resolve('.', start);
let tmp, stats = await toStats(dir);
if (!stats.isDirectory()) {
dir = dirname(dir);
}
while (true) {
tmp = await callback(dir, await toRead(dir));
if (tmp) return resolve(dir, tmp);
dir = dirname(tmp = dir);
if (tmp === dir) break;
}
}

Xet Storage Details

Size:
534 Bytes
·
Xet hash:
01c0004c316817e709403e49a471530c641d90de2c7832c4b59a861effe866ac

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.