working rss feed to nostr publish
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Uint8ArrayBlobAdapter = void 0;
|
||||
const transforms_1 = require("./transforms");
|
||||
class Uint8ArrayBlobAdapter extends Uint8Array {
|
||||
static fromString(source, encoding = "utf-8") {
|
||||
switch (typeof source) {
|
||||
case "string":
|
||||
return (0, transforms_1.transformFromString)(source, encoding);
|
||||
default:
|
||||
throw new Error(`Unsupported conversion from ${typeof source} to Uint8ArrayBlobAdapter.`);
|
||||
}
|
||||
}
|
||||
static mutate(source) {
|
||||
Object.setPrototypeOf(source, Uint8ArrayBlobAdapter.prototype);
|
||||
return source;
|
||||
}
|
||||
transformToString(encoding = "utf-8") {
|
||||
return (0, transforms_1.transformToString)(this, encoding);
|
||||
}
|
||||
}
|
||||
exports.Uint8ArrayBlobAdapter = Uint8ArrayBlobAdapter;
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.transformFromString = exports.transformToString = void 0;
|
||||
const util_base64_1 = require("@smithy/util-base64");
|
||||
const util_utf8_1 = require("@smithy/util-utf8");
|
||||
const Uint8ArrayBlobAdapter_1 = require("./Uint8ArrayBlobAdapter");
|
||||
function transformToString(payload, encoding = "utf-8") {
|
||||
if (encoding === "base64") {
|
||||
return (0, util_base64_1.toBase64)(payload);
|
||||
}
|
||||
return (0, util_utf8_1.toUtf8)(payload);
|
||||
}
|
||||
exports.transformToString = transformToString;
|
||||
function transformFromString(str, encoding) {
|
||||
if (encoding === "base64") {
|
||||
return Uint8ArrayBlobAdapter_1.Uint8ArrayBlobAdapter.mutate((0, util_base64_1.fromBase64)(str));
|
||||
}
|
||||
return Uint8ArrayBlobAdapter_1.Uint8ArrayBlobAdapter.mutate((0, util_utf8_1.fromUtf8)(str));
|
||||
}
|
||||
exports.transformFromString = transformFromString;
|
||||
Reference in New Issue
Block a user