cloudflare--workers-sdk
70bf21e064
Prerelease / build (push) Has been skipped
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Handle Changesets / Handle Changesets (push) Has been cancelled
Semgrep OSS scan / semgrep-oss (push) Has been cancelled
16 行
509 B
JavaScript
16 行
509 B
JavaScript
// Test `require()` of Node built-in module without prefix
|
|
const assert = require("assert");
|
|
// Test `require()` of Node built-in module with prefix
|
|
const assert2 = require("node:assert");
|
|
|
|
// `Buffer` should be global in `CommonJS`s with node_compat_v2 turned on
|
|
assert.strictEqual(typeof Buffer, "function");
|
|
assert2(true);
|
|
|
|
exports.base64Encode = function (data) {
|
|
return Buffer.from(data).toString("base64");
|
|
};
|
|
exports.base64Decode = function (data) {
|
|
return Buffer.from(data, "base64").toString();
|
|
};
|