From dc1fa769a7a13f673dfdbb9e1314472d8b28cf65 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Wed, 27 Mar 2019 10:38:57 -0400 Subject: [PATCH] doc: add note about mkdtemp() platform differences PR-URL: https://github.com/nodejs/node/pull/26944 Fixes: https://github.com/nodejs/node/issues/26435 Reviewed-By: Ruben Bridgewater Reviewed-By: Luigi Pinca Reviewed-By: Anatoli Papirovski --- doc/api/fs.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 8c629d02a4ce4a..9123048a3d929b 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -2277,7 +2277,10 @@ changes: Creates a unique temporary directory. Generates six random characters to be appended behind a required -`prefix` to create a unique temporary directory. +`prefix` to create a unique temporary directory. Due to platform +inconsistencies, avoid trailing `X` characters in `prefix`. Some platforms, +notably the BSDs, can return more than six random characters, and replace +trailing `X` characters in `prefix` with random characters. The created folder path is passed as a string to the callback's second parameter. @@ -4280,7 +4283,10 @@ added: v10.0.0 Creates a unique temporary directory and resolves the `Promise` with the created folder path. A unique directory name is generated by appending six random -characters to the end of the provided `prefix`. +characters to the end of the provided `prefix`. Due to platform +inconsistencies, avoid trailing `X` characters in `prefix`. Some platforms, +notably the BSDs, can return more than six random characters, and replace +trailing `X` characters in `prefix` with random characters. The optional `options` argument can be a string specifying an encoding, or an object with an `encoding` property specifying the character encoding to use.