2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

fs.watchでのファイル監視時に日本語ファイル名が正しく取得できない(node.js)

Last updated at Posted at 2015-09-19

fs.watchでのファイル監視時に日本語ファイル名が正しく取得できない(node.js)

fs.watchでファイル名を1バイトで取得しているために起こるらしい。

以下のようにすることで正しいファイル名が取得できる。

fs.watch(PATH, function(event, filename) {
  console.log(Buffer(filename, 'binary').toString());
});

2
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?