diff --git a/lib/commands.js b/lib/commands.js index 4af29a1..08dc41f 100644 --- a/lib/commands.js +++ b/lib/commands.js @@ -1,28 +1,13 @@ import { SevenZipStream } from './stream.js' -import { listenStdEvents } from './listeners.js' +import { matchPropsColon, matchPropsEquals, matchProgress } from './parser.js' -/** - * Add command - * @param archive {String} Path to the archive - * @param source {String|Array} Source to add - * @param options {Object} An object of acceptable options to 7za bin. - */ export function add (archive, source, options) { const opts = Object.assign({}, options) opts._commandArgs = ['a'] opts._commandArgs.push(archive, source) - opts._parser = 'symbolFile' + opts._matchHeaders = matchPropsEquals + opts._matchFiles = matchProgress + opts._matchFooters = matchPropsColon const stream = new SevenZipStream(opts) - listenStdEvents(stream) - return stream -} - -export function test (archive, options) { - const opts = Object.assign({}, options) - opts._commandArgs = ['t'] - opts._commandArgs.push(archive) - opts._parser = 'symbolFile' - const stream = new SevenZipStream(opts) - listenStdEvents(stream) return stream }