UNPKG

fs-zoo

Version:

File system abstractions and implementations

12 lines (11 loc) 408 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.hashToLocation = void 0; 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); return lastTwo + '/' + twoBeforeLastTwo + '/' + hash; }; exports.hashToLocation = hashToLocation;