|
|
@ -15,6 +15,10 @@ const ONEMB = bytes('1mb'); |
|
|
|
// how many concurrent HTTP/2 stream uploads
|
|
|
|
const MAX_CONCURRENT = 10; |
|
|
|
|
|
|
|
// check if running windows
|
|
|
|
const IS_WIN = /^win/.test(process.platform); |
|
|
|
const SEP = IS_WIN ? '\\' : '/'; |
|
|
|
|
|
|
|
export default class Now extends EventEmitter { |
|
|
|
constructor (token, { forceNew = false, debug = false }) { |
|
|
|
super(); |
|
|
@ -194,9 +198,9 @@ export default class Now extends EventEmitter { |
|
|
|
} |
|
|
|
|
|
|
|
function toRelative (path, base) { |
|
|
|
const fullBase = /\/$/.test(base) ? base + '/' : base; |
|
|
|
const fullBase = base.endsWith(SEP) ? base + SEP : base; |
|
|
|
const relative = path.substr(fullBase.length); |
|
|
|
if (relative.startsWith('/')) return relative.substr(1); |
|
|
|
if (relative.startsWith(SEP)) return relative.substr(1); |
|
|
|
return relative; |
|
|
|
} |
|
|
|
|
|
|
|