Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91345068
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
Sun, Nov 10, 04:50
Size
517 B
Mime Type
text/x-java
Expires
Tue, Nov 12, 04:50 (2 d)
Engine
blob
Format
Raw Data
Handle
22246708
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