0

in node.js, I have problem when import both packages (node-7z and xml2json),
I have some function that no one calls it ("dummy"),

    import { extractFull } from 'node-7z'
    const xml2json = require('xml2json');

    function dummy(){
        const myStream = extractFull('./zip/myfile.7z', './unzipped/')

    }

and I get the following error

C:\projects\nodeTests\node_modules\joi\lib\types\object\index.js:445
source-map-support.js:445
        Hoek.assert(isRegExp || pattern instanceof Any, 'pattern must be a regex or schema');
             ^
AssertionError [ERR_ASSERTION]: pattern must be a regex or schema
source-map-support.js:448
    at internals.Object.pattern (C:\projects\nodeTests\node_modules\joi\lib\types\object\index.js:445:14)
    at Object.internals.root (C:\projects\nodeTests\node_modules\joi\lib\index.js:432:34)
    at Object.<anonymous> (C:\projects\nodeTests\node_modules\joi\lib\index.js:447:28)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\projects\nodeTests\node_modules\xml2json\lib\xml2json.js:3:11)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)

*if I comment the code inside "dummy" function I dont get any error
*if I comment the line of require "xml2json" I dont get any error

why I have this problem and why how does the code in "dummy" function affect me if no one calls this function?
Thanks

Sujal Patel
  • 2,444
  • 1
  • 19
  • 38
larry ckey
  • 141
  • 2
  • 14

1 Answers1

0

https://github.com/quentinrossetti/node-7z according to this link you shoud pass an object with extractFull function for example

import Seven from 'node-7z'
const myStream = Seven.extractFull('./archive.7z', './output/dir/', { 
  $progress: true
});
Asif Khan
  • 56
  • 8