@open-audio-stack/core 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,7 +22,7 @@ export declare function fileJsonCreate(filePath: string, data: object): void;
22
22
  export declare function fileHash(filePath: string, algorithm?: string): string;
23
23
  export declare function fileMove(filePath: string, newPath: string): void | boolean;
24
24
  export declare function fileOpen(filePath: string): Buffer;
25
- export declare function fileRead(filePath: string): Buffer;
25
+ export declare function fileRead(filePath: string): string;
26
26
  export declare function fileReadJson(filePath: string): any;
27
27
  export declare function fileReadString(filePath: string): string;
28
28
  export declare function fileReadYaml(filePath: string): unknown;
@@ -128,7 +128,8 @@ export function fileJsonCreate(filePath, data) {
128
128
  }
129
129
  export function fileHash(filePath, algorithm = 'sha256') {
130
130
  const fileData = fileReadString(filePath);
131
- return createHash(algorithm).update(fileData, 'utf8').digest('hex');
131
+ const fileNormalized = fileData.replace(/\r\n/g, '\n');
132
+ return createHash(algorithm).update(fileNormalized, 'utf8').digest('hex');
132
133
  }
133
134
  export function fileMove(filePath, newPath) {
134
135
  if (fileExists(filePath)) {
@@ -153,18 +154,18 @@ export function fileOpen(filePath) {
153
154
  }
154
155
  export function fileRead(filePath) {
155
156
  console.log('⎋', filePath);
156
- return readFileSync(filePath);
157
+ return readFileSync(filePath, 'utf8');
157
158
  }
158
159
  export function fileReadJson(filePath) {
159
160
  if (fileExists(filePath)) {
160
161
  console.log('⎋', filePath);
161
- return JSON.parse(readFileSync(filePath).toString());
162
+ return JSON.parse(readFileSync(filePath, 'utf8').toString());
162
163
  }
163
164
  return false;
164
165
  }
165
166
  export function fileReadString(filePath) {
166
167
  console.log('⎋', filePath);
167
- return readFileSync(filePath).toString();
168
+ return readFileSync(filePath, 'utf8').toString();
168
169
  }
169
170
  export function fileReadYaml(filePath) {
170
171
  const file = fileReadString(filePath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-audio-stack/core",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "Open-source audio plugin management software",
5
5
  "type": "module",
6
6
  "main": "./build/index.js",