1 | ;
|
2 | /**
|
3 | * @license
|
4 | * Copyright Google LLC All Rights Reserved.
|
5 | *
|
6 | * Use of this source code is governed by an MIT-style license that can be
|
7 | * found in the LICENSE file at https://angular.io/license
|
8 | */
|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
10 | exports.fileBuffer = exports.fileBufferToString = exports.stringToFileBuffer = void 0;
|
11 | const node_util_1 = require("node:util");
|
12 | function stringToFileBuffer(str) {
|
13 | return new node_util_1.TextEncoder().encode(str).buffer;
|
14 | }
|
15 | exports.stringToFileBuffer = stringToFileBuffer;
|
16 | function fileBufferToString(fileBuffer) {
|
17 | if (fileBuffer.toString.length === 1) {
|
18 | return fileBuffer.toString('utf-8');
|
19 | }
|
20 | return new node_util_1.TextDecoder('utf-8').decode(new Uint8Array(fileBuffer));
|
21 | }
|
22 | exports.fileBufferToString = fileBufferToString;
|
23 | /** @deprecated use `stringToFileBuffer` instead. */
|
24 | const fileBuffer = (strings, ...values) => {
|
25 | return stringToFileBuffer(String.raw(strings, ...values));
|
26 | };
|
27 | exports.fileBuffer = fileBuffer;
|
28 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVmZmVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvYW5ndWxhcl9kZXZraXQvY29yZS9zcmMvdmlydHVhbC1mcy9ob3N0L2J1ZmZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7OztHQU1HOzs7QUFFSCx5Q0FBcUQ7QUFJckQsU0FBZ0Isa0JBQWtCLENBQUMsR0FBVztJQUM1QyxPQUFPLElBQUksdUJBQVcsRUFBRSxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQyxNQUFNLENBQUM7QUFDOUMsQ0FBQztBQUZELGdEQUVDO0FBRUQsU0FBZ0Isa0JBQWtCLENBQU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