func (n *NPMLookup) ReadPackagesFromFile(filename string) error {
	rawfile, err := ioutil.ReadFile(filename)
	if err != nil {
		return err
	}
	data := PackageJSON{}
	err = json.Unmarshal([]byte(rawfile), &data)
	if err != nil {
		fmt.Printf(" [W] Non-fatal issue encountered while reading %s : %s\n", filename, err)
	}
	for pkgname, pkgversion := range data.Dependencies {
		n.Packages = append(n.Packages, NPMPackage{pkgname, pkgversion})
	}
	for pkgname, pkgversion := range data.DevDependencies {
		n.Packages = append(n.Packages, NPMPackage{pkgname, pkgversion})
	}
	for pkgname, pkgversion := range data.PeerDependencies {
		n.Packages = append(n.Packages, NPMPackage{pkgname, pkgversion})
	}
	for pkgname, pkgversion := range data.OptionalDependencies {
		n.Packages = append(n.Packages, NPMPackage{pkgname, pkgversion})
	}
	for _, pkgname := range data.BundledDependencies {
		n.Packages = append(n.Packages, NPMPackage{pkgname, ""})
	}
	for _, pkgname := range data.BundleDependencies {
		n.Packages = append(n.Packages, NPMPackage{pkgname, ""})
	}
	return nil
}
// ReadPackagesFromFile reads package information from an npm package.json file
//
// Returns any errors encountered
ReadPackagesFromFile reads package information from an npm package.json file

Returns any errors encountered
// ReadPackagesFromFile reads package information from an npm package . json file // // Returns any errors encountered
func (n *NPMLookup) ReadPackagesFromFile(filename string) error {
	rawfile, err := ioutil.ReadFile(filename)
	if err != nil {
		return err
	}
	data := PackageJSON{}
	err = json.Unmarshal([]byte(rawfile), &data)
	if err != nil {
		fmt.Printf(" [W] Non-fatal issue encountered while reading %s : %s\n", filename, err)
	}
	for pkgname, pkgversion := range data.Dependencies {
		n.Packages = append(n.Packages, NPMPackage{pkgname, pkgversion})
	}
	for pkgname, pkgversion := range data.DevDependencies {
		n.Packages = append(n.Packages, NPMPackage{pkgname, pkgversion})
	}
	for pkgname, pkgversion := range data.PeerDependencies {
		n.Packages = append(n.Packages, NPMPackage{pkgname, pkgversion})
	}
	for pkgname, pkgversion := range data.OptionalDependencies {
		n.Packages = append(n.Packages, NPMPackage{pkgname, pkgversion})
	}
	for _, pkgname := range data.BundledDependencies {
		n.Packages = append(n.Packages, NPMPackage{pkgname, ""})
	}
	for _, pkgname := range data.BundleDependencies {
		n.Packages = append(n.Packages, NPMPackage{pkgname, ""})
	}
	return nil
}
func ( n * NPMLookup ) ReadPackagesFromFile ( filename string ) error { rawfile , err := ioutil . ReadFile ( filename ) if err != nil { return err } data := PackageJSON { } err = json . Unmarshal ( [ ] byte ( rawfile ) , & data ) if err != nil { fmt . Printf ( " \n " , filename , err ) } for pkgname , pkgversion := range data . Dependencies { n . Packages = append ( n . Packages , NPMPackage { pkgname , pkgversion } ) } for pkgname , pkgversion := range data . DevDependencies { n . Packages = append ( n . Packages , NPMPackage { pkgname , pkgversion } ) } for pkgname , pkgversion := range data . PeerDependencies { n . Packages = append ( n . Packages , NPMPackage { pkgname , pkgversion } ) } for pkgname , pkgversion := range data . OptionalDependencies { n . Packages = append ( n . Packages , NPMPackage { pkgname , pkgversion } ) } for _ , pkgname := range data . BundledDependencies { n . Packages = append ( n . Packages , NPMPackage { pkgname , " " } ) } for _ , pkgname := range data . BundleDependencies { n . Packages = append ( n . Packages , NPMPackage { pkgname , " " } ) } return nil }
ReadPackagesFromFile reads package information from an npm package.json file
ReadPackagesFromFile reads package information from an npm package . json file