This commit ports the crypt library from the Core repository to the Enchantrix repository. It includes the following changes: - The project is now a Go module. - The `lthn` and `crypt` packages have been ported from the Core repository. - The PGP functionality has been commented out pending resolution of dependency issues. - The old Deno project has been moved to the `vault` directory. - The README has been updated to reflect the new project structure.
33 lines
760 B
TypeScript
33 lines
760 B
TypeScript
#!deno run --allow-read --allow-net
|
|
|
|
import * as path from "https://deno.land/std@0.122.0/path/mod.ts";
|
|
import { readableStreamFromReader } from "https://deno.land/std@0.122.0/streams/mod.ts";
|
|
import {EnchantrixLog} from '../log.ts';
|
|
|
|
export class EnchantrixParseFile {
|
|
|
|
protected _input: string;
|
|
protected _data: any;
|
|
|
|
constructor(file: string) {
|
|
this._input = file;
|
|
}
|
|
|
|
load() {
|
|
|
|
try {
|
|
this._data = Deno.openSync(this._input, { read: true });
|
|
const stat = this._data.statSync();
|
|
|
|
} catch {
|
|
throw new EnchantrixLog('Failed to load file')
|
|
}
|
|
|
|
// Build a readable stream so the file doesn't have to be fully loaded into
|
|
// memory while we send it
|
|
const readableStream = readableStreamFromReader(this._data);
|
|
|
|
return readableStream
|
|
|
|
}
|
|
}
|