Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92023115
index.mjs
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Nov 16, 17:09
Size
517 B
Mime Type
text/x-java
Expires
Mon, Nov 18, 17:09 (2 d)
Engine
blob
Format
Raw Data
Handle
22364943
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
index.mjs
View Options
import { dirname, resolve } from 'path';
import { readdir, stat } from 'fs';
import { promisify } from 'util';
const toStats = promisify(stat);
const toRead = promisify(readdir);
export default 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;
}
}
Event Timeline
Log In to Comment