Fixes #1 Allow for multiple artifacts
This commit is contained in:
22
src/Artifact.ts
Normal file
22
src/Artifact.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { basename } from "path";
|
||||
import { readFileSync, statSync } from "fs";
|
||||
|
||||
export class Artifact {
|
||||
readonly contentType: string
|
||||
readonly name: string
|
||||
readonly path: string
|
||||
|
||||
constructor(path: string, contentType: string = "raw") {
|
||||
this.path = path
|
||||
this.name = basename(path)
|
||||
this.contentType = contentType;
|
||||
}
|
||||
|
||||
get contentLength(): number {
|
||||
return statSync(this.path).size
|
||||
}
|
||||
|
||||
readFile(): Buffer {
|
||||
return readFileSync(this.path)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user