mirror of
https://gitee.com/onvia/ccc-tnt-psd2ui
synced 2024-12-28 04:27:42 +00:00
53 lines
2.4 KiB
JavaScript
53 lines
2.4 KiB
JavaScript
"use strict";
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
}
|
|
Object.defineProperty(o, k2, desc);
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.writePsdBuffer = exports.writePsdUint8Array = exports.writePsd = exports.readPsd = exports.byteArrayToBase64 = exports.initializeCanvas = void 0;
|
|
var psdWriter_1 = require("./psdWriter");
|
|
var psdReader_1 = require("./psdReader");
|
|
__exportStar(require("./abr"), exports);
|
|
__exportStar(require("./csh"), exports);
|
|
var helpers_1 = require("./helpers");
|
|
Object.defineProperty(exports, "initializeCanvas", { enumerable: true, get: function () { return helpers_1.initializeCanvas; } });
|
|
__exportStar(require("./psd"), exports);
|
|
var base64_js_1 = require("base64-js");
|
|
exports.byteArrayToBase64 = base64_js_1.fromByteArray;
|
|
function readPsd(buffer, options) {
|
|
var reader = 'buffer' in buffer ?
|
|
(0, psdReader_1.createReader)(buffer.buffer, buffer.byteOffset, buffer.byteLength) :
|
|
(0, psdReader_1.createReader)(buffer);
|
|
return (0, psdReader_1.readPsd)(reader, options);
|
|
}
|
|
exports.readPsd = readPsd;
|
|
function writePsd(psd, options) {
|
|
var writer = (0, psdWriter_1.createWriter)();
|
|
(0, psdWriter_1.writePsd)(writer, psd, options);
|
|
return (0, psdWriter_1.getWriterBuffer)(writer);
|
|
}
|
|
exports.writePsd = writePsd;
|
|
function writePsdUint8Array(psd, options) {
|
|
var writer = (0, psdWriter_1.createWriter)();
|
|
(0, psdWriter_1.writePsd)(writer, psd, options);
|
|
return (0, psdWriter_1.getWriterBufferNoCopy)(writer);
|
|
}
|
|
exports.writePsdUint8Array = writePsdUint8Array;
|
|
function writePsdBuffer(psd, options) {
|
|
if (typeof Buffer === 'undefined') {
|
|
throw new Error('Buffer not supported on this platform');
|
|
}
|
|
return Buffer.from(writePsdUint8Array(psd, options));
|
|
}
|
|
exports.writePsdBuffer = writePsdBuffer;
|
|
//# sourceMappingURL=index.js.map
|