silverwolf-x/project / packages /next /src /server /node-polyfill-crypto.ts
silverwolf-x's picture
download
raw
494 Bytes
// Polyfill crypto() in the Node.js environment
if (!global.crypto) {
let webcrypto: Crypto | undefined
Object.defineProperty(global, 'crypto', {
enumerable: false,
configurable: true,
get() {
if (!webcrypto) {
// @ts-expect-error -- TODO: Is this actually safe?
webcrypto = (require('node:crypto') as typeof import('node:crypto'))
.webcrypto
}
return webcrypto
},
set(value: Crypto) {
webcrypto = value
},
})
}

Xet Storage Details

Size:
494 Bytes
·
Xet hash:
de99c6ac7cc968a77133b3ad7ca9a0d6d57388dda162ceda10160871f39f7d20

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.