Using node to determine whether the opened file or folder instance

Time:2020-1-25

As follows:

var fs = require("fs");
//Determine whether the file or folder is opened
var path = "wen.txt";
fs.stat(path,function(err,stat){
	if (err) {
		console.error(err);
		throw err;
	}
	console.log(stat);
	Console. Info (path + "is a" + stat.isfile());
	Console. Info (path + "is a" + stat.isdirectory());
});
Console.info ("file opened successfully...);

The above example of using node to determine whether a file or a folder is opened is all the content shared by Xiaobian. I hope it can give you a reference, and I hope you can support developepaer more.

Recommended Today

Notes on tensorflow 2 deep learning (I) tensorflow Foundation

This series of notes records the process of learning tensorflow2, mainly based on https://github.com/dragen1860/Deep-Learning-with-TensorFlow-book Learning First of all, it needs to be clear that tensorflow is a scientific computing library for deep learning algorithm, and the internal data is stored in theTensor objectAll operations (OPS) are also based on tensor objects. data type Fundamentals in […]