mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-02-13 10:52:53 +00:00
32 lines
734 B
TypeScript
32 lines
734 B
TypeScript
import * as path from "path";
|
|
import AnonymizedFile from "../AnonymizedFile";
|
|
import Repository from "../Repository";
|
|
import storage from "../storage";
|
|
import { SourceBase } from "../types";
|
|
import * as stream from "stream";
|
|
|
|
export default class Zip implements SourceBase {
|
|
type = "Zip";
|
|
repository: Repository;
|
|
url?: string;
|
|
|
|
constructor(data: any, repository: Repository) {
|
|
this.repository = repository;
|
|
this.url = data.url;
|
|
}
|
|
|
|
async getFiles() {
|
|
return storage.listFiles(this.repository.originalCachePath);
|
|
}
|
|
|
|
async getFileContent(file: AnonymizedFile): Promise<stream.Readable> {
|
|
return storage.read(file.originalCachePath);
|
|
}
|
|
|
|
toJSON(): any {
|
|
return {
|
|
type: this.type,
|
|
};
|
|
}
|
|
}
|