Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

magic.detectFile ended without throwing error #118

Open
tmxkwkfgka opened this issue Nov 1, 2017 · 1 comment
Open

magic.detectFile ended without throwing error #118

tmxkwkfgka opened this issue Nov 1, 2017 · 1 comment

Comments

@tmxkwkfgka
Copy link

tmxkwkfgka commented Nov 1, 2017

const fs = require('fs');
const async = require('async')
const path = require('path')
const Magic = require('mmmagic').Magic;
const magic = new Magic();

//folderpath = C:\Program Files\MySQL\MySQL Workbench 6.3 CE\modules\data\sqlide
``
function magicAll(folderPath){
	fs.readdir(folderPath, (err, files)=>{
		files.forEach(file=>{
			console.log(file)
			try{
				magic.detectFile(path.join(folderPath, file), (err, res)=>{
				if(err)
					console.log('detect err = ', err)

				console.log('result = ', res)

			})
			}catch(err){
				console.log('catch err = ', err)
			}
			
		})
	})
}

magicAll('C:/Program Files/MySQL/MySQL Workbench 6.3 CE/modules/data/sqlide')

console result :
CSV.pre.tpl
CSV.tpl
CSV.tpli
CSV_semicolon.pre.tpl
CSV_semicolon.tpl
CSV_semicolon.tpli
HTML.post.tpl
HTML.pre.tpl
HTML.tpl
HTML.tpli
JSON.post.tpl
JSON.pre.tpl
JSON.tpl
JSON.tpli
SQL_inserts.pre.tpl
SQL_inserts.tpl
SQL_inserts.tpli
tab.pre.tpl
tab.tpl
tab.tpli
XLS.post.tpl
XLS.pre.tpl
XLS.tpl
XLS.tpli
XML.post.tpl
XML.pre.tpl
XML.tpl
XML.tpli
XML_mysql.post.tpl
XML_mysql.pre.tpl
XML_mysql.tpl
XML_mysql.tpli

my OS : window7

I use magic.detectFile to know type of the file. but when I detect folder: C:\Program Files\MySQL\MySQL Workbench 6.3 CE\modules\data\sqlide which have .tpl .tpli file.
detectFile ended without throwing error or result.

@mscdex
Copy link
Owner

mscdex commented Feb 27, 2018

Can you try with v0.5.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants