assemblyai 4.0.0-beta.1 → 4.0.0-beta.3

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.
@@ -0,0 +1,9 @@
1
+ declare const Deno: {
2
+ open(path: string): Promise<DenoFile>;
3
+ };
4
+ declare type DenoFile = {
5
+ readable: ReadableStream<Uint8Array>;
6
+ };
7
+
8
+ export const readFile = async (path: string) =>
9
+ (await Deno.open(path)).readable;
@@ -0,0 +1,8 @@
1
+ export const readFile = async function (
2
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
3
+ path: string
4
+ ): Promise<ReadableStream<Uint8Array>> {
5
+ throw new Error(
6
+ "Interacting with the file system is not supported in this environment."
7
+ );
8
+ };
@@ -0,0 +1,7 @@
1
+ import { createReadStream } from "fs";
2
+ import { Readable } from "stream";
3
+
4
+ export const readFile = async (path: string) =>
5
+ Readable.toWeb(
6
+ createReadStream(path)
7
+ ) as unknown as ReadableStream<Uint8Array>;
@@ -0,0 +1,6 @@
1
+ export const { WritableStream } =
2
+ typeof window !== "undefined"
3
+ ? window
4
+ : typeof global !== "undefined"
5
+ ? global
6
+ : globalThis;
@@ -0,0 +1 @@
1
+ export { WritableStream } from "stream/web";
@@ -0,0 +1,15 @@
1
+ var ws = null;
2
+
3
+ if (typeof WebSocket !== "undefined") {
4
+ ws = WebSocket;
5
+ } else if (typeof MozWebSocket !== "undefined") {
6
+ ws = MozWebSocket;
7
+ } else if (typeof global !== "undefined") {
8
+ ws = global.WebSocket || global.MozWebSocket;
9
+ } else if (typeof window !== "undefined") {
10
+ ws = window.WebSocket || window.MozWebSocket;
11
+ } else if (typeof self !== "undefined") {
12
+ ws = self.WebSocket || self.MozWebSocket;
13
+ }
14
+
15
+ export default ws;
@@ -0,0 +1 @@
1
+ module.exports = require("ws");
@@ -0,0 +1,2 @@
1
+ import ws from "ws";
2
+ export default ws;
@@ -0,0 +1,2 @@
1
+ import ws from "ws";
2
+ export default ws;
@@ -1,4 +1,4 @@
1
- import fs from "fs";
1
+ import { readFile } from "#fs";
2
2
  import { BaseService } from "../base";
3
3
  import { UploadedFile, FileUploadParams, FileUploadData } from "../..";
4
4
 
@@ -10,7 +10,7 @@ export class FileService extends BaseService {
10
10
  */
11
11
  async upload(input: FileUploadParams): Promise<string> {
12
12
  let fileData: FileUploadData;
13
- if (typeof input === "string") fileData = fs.createReadStream(input);
13
+ if (typeof input === "string") fileData = await readFile(input);
14
14
  else fileData = input;
15
15
 
16
16
  const data = await this.fetchJson<UploadedFile>("/v2/upload", {
@@ -1,5 +1,5 @@
1
- import { WritableStream } from "@swimburger/isomorphic-streams";
2
- import WebSocket from "isomorphic-ws";
1
+ import { WritableStream } from "#streams";
2
+ import WebSocket from "#ws";
3
3
  import { ErrorEvent, MessageEvent, CloseEvent } from "ws";
4
4
  import {
5
5
  RealtimeEvents,
@@ -1,6 +0,0 @@
1
- declare function throwError(): void;
2
- export declare const createReadStream: typeof throwError;
3
- declare const _default: {
4
- createReadStream: typeof throwError;
5
- };
6
- export default _default;
@@ -1,8 +0,0 @@
1
- function throwError() {
2
- throw new Error("'fs' is not supported in this environment.");
3
- }
4
-
5
- export const createReadStream = throwError;
6
- export default {
7
- createReadStream,
8
- };