Merge pull request #202 from dolanmiu/feat/correct-mine-type

Remove async await for Compiler.compile
This commit is contained in:
Dolan
2019-01-03 10:45:56 +00:00
committed by GitHub
3 changed files with 6 additions and 6 deletions

View File

@ -17,7 +17,7 @@ describe("Compiler", () => {
describe("#compile()", () => { describe("#compile()", () => {
it("should pack all the content", async function() { it("should pack all the content", async function() {
this.timeout(99999999); this.timeout(99999999);
const zipFile = await compiler.compile(file); const zipFile = compiler.compile(file);
const fileNames = Object.keys(zipFile.files).map((f) => zipFile.files[f].name); const fileNames = Object.keys(zipFile.files).map((f) => zipFile.files[f].name);
expect(fileNames).is.an.instanceof(Array); expect(fileNames).is.an.instanceof(Array);
@ -46,7 +46,7 @@ describe("Compiler", () => {
this.timeout(99999999); this.timeout(99999999);
const zipFile = await compiler.compile(file); const zipFile = compiler.compile(file);
const fileNames = Object.keys(zipFile.files).map((f) => zipFile.files[f].name); const fileNames = Object.keys(zipFile.files).map((f) => zipFile.files[f].name);
expect(fileNames).is.an.instanceof(Array); expect(fileNames).is.an.instanceof(Array);

View File

@ -36,7 +36,7 @@ export class Compiler {
this.imageReplacer = new ImageReplacer(); this.imageReplacer = new ImageReplacer();
} }
public async compile(file: File): Promise<JSZip> { public compile(file: File): JSZip {
const zip = new JSZip(); const zip = new JSZip();
const xmlifiedFileMapping = this.xmlifyFile(file); const xmlifiedFileMapping = this.xmlifyFile(file);

View File

@ -9,7 +9,7 @@ export class Packer {
} }
public async toBuffer(file: File): Promise<Buffer> { public async toBuffer(file: File): Promise<Buffer> {
const zip = await this.compiler.compile(file); const zip = this.compiler.compile(file);
const zipData = (await zip.generateAsync({ const zipData = (await zip.generateAsync({
type: "nodebuffer", type: "nodebuffer",
mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
@ -19,7 +19,7 @@ export class Packer {
} }
public async toBase64String(file: File): Promise<string> { public async toBase64String(file: File): Promise<string> {
const zip = await this.compiler.compile(file); const zip = this.compiler.compile(file);
const zipData = (await zip.generateAsync({ const zipData = (await zip.generateAsync({
type: "base64", type: "base64",
mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
@ -29,7 +29,7 @@ export class Packer {
} }
public async toBlob(file: File): Promise<Blob> { public async toBlob(file: File): Promise<Blob> {
const zip = await this.compiler.compile(file); const zip = this.compiler.compile(file);
const zipData = (await zip.generateAsync({ const zipData = (await zip.generateAsync({
type: "blob", type: "blob",
mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",