Giter VIP home page Giter VIP logo

Comments (1)

codeautopilot avatar codeautopilot commented on August 27, 2024 1

To exclude binary files in the functions that retrieve files in the repo, you can use the isbinaryfile package to check if a file is binary or not. Here's how you can do it:

  1. Install the isbinaryfile package by running:
npm install isbinaryfile
  1. In the modules/fsInput.js file, update the getFilePaths function as follows:
const { isBinaryFileSync } = require("isbinaryfile");

function getFilePaths(dir) {
	const files = fs.readdirSync(dir);
	const projectFiles = [];

	for (const file of files) {
		const filePath = path.posix.join(dir, file);
		const stats = fs.statSync(filePath);

		if (stats.isDirectory() && !ignoreList.includes(file)) {
			projectFiles.push(...getFilePaths(filePath));
		} else if (fileExtensionsToProcess.includes(path.extname(filePath))) {
			// Check if the file is not a binary file
			if (!isBinaryFileSync(filePath)) {
				projectFiles.push(filePath);
			}
		}
	}

	return projectFiles;
};

By using the isbinaryfile package, the getFilePaths function will now exclude binary files when retrieving files in the repo, thus preventing errors caused by processing binary files.

from autopilot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.