@pistonite/pure 0.27.1 → 0.28.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pistonite/pure",
3
- "version": "0.27.1",
3
+ "version": "0.28.0",
4
4
  "type": "module",
5
5
  "description": "Pure TypeScript libraries for my projects",
6
6
  "homepage": "https://github.com/Pistonite/pure",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "devDependencies": {
30
30
  "vitest": "^3.2.4",
31
- "mono-dev": "0.2.5"
31
+ "mono-dev": "0.2.7"
32
32
  },
33
33
  "dependencies": {
34
34
  "denque": "^2.1.0"
package/src/fs/FsFile.ts CHANGED
@@ -33,7 +33,7 @@ export interface FsFile {
33
33
  * Set the content in memory. Does not save to disk.
34
34
  * Does nothing if file is closed
35
35
  */
36
- setBytes(content: Uint8Array): void;
36
+ setBytes(content: Uint8Array<ArrayBuffer>): void;
37
37
 
38
38
  /**
39
39
  * Load the file's content if it's not newer than fs
@@ -24,7 +24,7 @@ class FsFileImpl implements FsFile {
24
24
  /** If the file is text */
25
25
  private isText: boolean;
26
26
  /** Bytes of the file */
27
- private buffer: Uint8Array | undefined;
27
+ private buffer: Uint8Array<ArrayBuffer> | undefined;
28
28
  /** If the content in the buffer is different from the content on FS */
29
29
  private isBufferDirty: boolean;
30
30
  /** The content string of the file */
@@ -115,7 +115,7 @@ class FsFileImpl implements FsFile {
115
115
  this.lastModified = new Date().getTime();
116
116
  }
117
117
 
118
- public setBytes(content: Uint8Array): void {
118
+ public setBytes(content: Uint8Array<ArrayBuffer>): void {
119
119
  if (this.closed) {
120
120
  return;
121
121
  }
@@ -104,7 +104,7 @@ export class FsFileStandaloneImplHandleAPI implements FsFileStandalone {
104
104
  return { err: fsFail(errstr(e)) };
105
105
  }
106
106
  }
107
- public async write(content: Uint8Array | string): Promise<FsVoid> {
107
+ public async write(content: Uint8Array<ArrayBuffer> | string): Promise<FsVoid> {
108
108
  const writable = await this.isWritable();
109
109
  if (!writable) {
110
110
  return {
@@ -21,7 +21,7 @@ export interface FsFileSystemInternal {
21
21
  * Returns NotSupported if the browser does not support this
22
22
  * Returns PermissionDenied if the operation is supported, but permission is not given
23
23
  */
24
- write: (path: string, content: Uint8Array) => Promise<FsVoid>;
24
+ write: (path: string, content: Uint8Array<ArrayBuffer>) => Promise<FsVoid>;
25
25
 
26
26
  /**
27
27
  * Forget about a file
@@ -103,7 +103,7 @@ export class FsImplHandleAPI implements FsFileSystemUninit, FsFileSystem, FsFile
103
103
  return file;
104
104
  }
105
105
 
106
- public async write(path: string, content: Uint8Array): Promise<FsVoid> {
106
+ public async write(path: string, content: Uint8Array<ArrayBuffer>): Promise<FsVoid> {
107
107
  if (!this.writeMode) {
108
108
  const err = fsErr(FsErr.PermissionDenied, "Write mode not requested");
109
109
  return { err };
package/src/fs/FsSave.ts CHANGED
@@ -3,7 +3,7 @@ import { ilog } from "../log/internal.ts";
3
3
  import { fsFail, type FsVoid } from "./FsError.ts";
4
4
 
5
5
  /** Save (download) a file using Blob */
6
- export function fsSave(content: string | Uint8Array, filename: string): FsVoid {
6
+ export function fsSave(content: string | Uint8Array<ArrayBuffer>, filename: string): FsVoid {
7
7
  const blob = new Blob([content], {
8
8
  // maybe lying, but should be fine
9
9
  type: "text/plain;charset=utf-8",