MCPcopy Index your code
hub / github.com/nodejs/nodejs.org / writeToFile

Function writeToFile

apps/site/scripts/release-post/index.mjs:242–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240};
241
242const writeToFile = results => {
243 const blogPostPath = resolve(
244 __dirname,
245 '../../pages/en/blog/release',
246 `v${results.version}.md`
247 );
248
249 return new Promise((resolve, reject) => {
250 if (existsSync(blogPostPath) && !ARGS.SHOULD_FORCE) {
251 reject(ERRORS.RELEASE_EXISTS(results.version));
252 return;
253 }
254
255 writeFile(blogPostPath, results.content)
256 .then(() => resolve(blogPostPath))
257 .catch(error => reject(ERRORS.FAILED_FILE_CREATION(error.message)));
258 });
259};
260
261const slugify = str => str.replace(/\./g, '-');
262

Callers

nothing calls this directly

Calls 1

resolveFunction · 0.85

Tested by

no test coverage detected