Skip to content

Commit

Permalink
Feature: test written CHDs with info after creation (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmercm authored May 8, 2024
1 parent 630a261 commit 9bd5067
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/chdman/chdmanCd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import util from 'node:util';
import fs from 'node:fs';
import ChdmanBin from './chdmanBin.js';
import { CHDCompressionAlgorithm } from './common.js';
import ChdmanInfo from './chdmanInfo.js';

export interface CreateCdOptions {
outputFilename: string,
Expand Down Expand Up @@ -47,6 +48,15 @@ export default {
}
throw error;
}

// Test the created file
try {
await ChdmanInfo.info({
inputFilename: options.outputFilename,
});
} catch (error) {
throw new Error(`created CHD is invalid: ${error}`);
}
},

/**
Expand Down
10 changes: 10 additions & 0 deletions src/chdman/chdmanDvd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import util from 'node:util';
import fs from 'node:fs';
import ChdmanBin from './chdmanBin.js';
import { CHDCompressionAlgorithm } from './common.js';
import ChdmanInfo from './chdmanInfo.js';

export interface CreateDvdOptions {
outputFilename: string,
Expand Down Expand Up @@ -45,6 +46,15 @@ export default {
}
throw error;
}

// Test the created file
try {
await ChdmanInfo.info({
inputFilename: options.outputFilename,
});
} catch (error) {
throw new Error(`created CHD is invalid: ${error}`);
}
},

/**
Expand Down
10 changes: 10 additions & 0 deletions src/chdman/chdmanHd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import util from 'node:util';
import fs from 'node:fs';
import ChdmanBin from './chdmanBin.js';
import { CHDCompressionAlgorithm } from './common.js';
import ChdmanInfo from './chdmanInfo.js';

export interface CreateHdOptions {
outputFilename: string,
Expand Down Expand Up @@ -68,6 +69,15 @@ export default {
}
throw error;
}

// Test the created file
try {
await ChdmanInfo.info({
inputFilename: options.outputFilename,
});
} catch (error) {
throw new Error(`created CHD is invalid: ${error}`);
}
},

/**
Expand Down
10 changes: 10 additions & 0 deletions src/chdman/chdmanRaw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import util from 'node:util';
import fs from 'node:fs';
import { CHDCompressionAlgorithm } from './common.js';
import ChdmanBin from './chdmanBin.js';
import ChdmanInfo from './chdmanInfo.js';

export interface CreateRawOptions {
outputFilename: string,
Expand Down Expand Up @@ -57,6 +58,15 @@ export default {
}
throw error;
}

// Test the created file
try {
await ChdmanInfo.info({
inputFilename: options.outputFilename,
});
} catch (error) {
throw new Error(`created CHD is invalid: ${error}`);
}
},

async extractRaw(options: ExtractRawOptions): Promise<void> {
Expand Down

0 comments on commit 9bd5067

Please sign in to comment.