diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e3fbd98 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build +node_modules diff --git a/magic/magic.mgc b/magic/magic.mgc index 2fdc46d..e701e04 100644 Binary files a/magic/magic.mgc and b/magic/magic.mgc differ diff --git a/package.json b/package.json index 68a8afa..9d3ee72 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mmmagic", - "version": "0.5.3", + "version": "0.5.4", "author": "Brian White ", "description": "An async libmagic binding for node.js for detecting content types by data inspection", "main": "./lib/index", diff --git a/test/fixtures/doc_as_doc.docx b/test/fixtures/doc_as_doc.docx new file mode 100644 index 0000000..bc215f7 Binary files /dev/null and b/test/fixtures/doc_as_doc.docx differ diff --git a/test/fixtures/doc_as_zip.docx b/test/fixtures/doc_as_zip.docx new file mode 100644 index 0000000..d7c5dfb Binary files /dev/null and b/test/fixtures/doc_as_zip.docx differ diff --git "a/test/fixtures/t\303\251st.txt" b/test/fixtures/test.txt similarity index 100% rename from "test/fixtures/t\303\251st.txt" rename to test/fixtures/test.txt diff --git a/test/test.js b/test/test.js index 934b011..ba04854 100644 --- a/test/test.js +++ b/test/test.js @@ -78,7 +78,7 @@ var tests = [ }, { run: function() { var magic = new mmm.Magic(mmm.MAGIC_MIME_TYPE); - magic.detectFile(path.join(__dirname, 'fixtures', 'tést.txt'), + magic.detectFile(path.join(__dirname, 'fixtures', 'test.txt'), function(err, result) { assert.strictEqual(err, null); assert.strictEqual(result, 'text/x-c++'); @@ -87,6 +87,28 @@ var tests = [ }, what: 'detectFile - UTF-8 filename' }, + { run: function() { + var magic = new mmm.Magic(mmm.MAGIC_MIME_TYPE); + magic.detectFile(path.join(__dirname, 'fixtures', 'doc_as_zip.docx'), + function(err, result) { + assert.strictEqual(err, null); + assert.strictEqual(result, 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'); + next(); + }); + }, + what: 'detectFile - docx as zip file' + }, + { run: function() { + var magic = new mmm.Magic(mmm.MAGIC_MIME_TYPE); + magic.detectFile(path.join(__dirname, 'fixtures', 'doc_as_doc.docx'), + function(err, result) { + assert.strictEqual(err, null); + assert.strictEqual(result, 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'); + next(); + }); + }, + what: 'detectFile - docx as docx file' + }, { run: function() { var buf = fs.readFileSync(path.join(__dirname, '..', 'src', 'binding.cc')); var magic = new mmm.Magic(mmm.MAGIC_MIME_TYPE); diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..ce1a872 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,8 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +nan@^2.13.2: + version "2.14.2" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.2.tgz#f5376400695168f4cc694ac9393d0c9585eeea19" + integrity sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==