UNPKG

@ezdevlol/memfs

Version:

In-memory file-system with Node's fs API.

9 lines (8 loc) 281 B
export const hashToLocation = (hash) => { if (hash.length < 20) throw new TypeError('Hash is too short'); const lastTwo = hash.slice(-2); const twoBeforeLastTwo = hash.slice(-4, -2); const folder = [lastTwo, twoBeforeLastTwo]; return [folder, hash]; };