<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[fs.stat  SyntaxError: Unexpected token]]></title><description><![CDATA[<p dir="auto">Hello everyone,<br />
I try to apply fs.stat to find if a file exists but I constantly get this error:</p>
<pre><code>fs.stat((err) =&gt; {
  ^
SyntaxError: Unexpected token .
</code></pre>
<p dir="auto">Can someone help me how to fix it?</p>
]]></description><link>https://forum.magicmirror.builders/topic/6526/fs-stat-syntaxerror-unexpected-token</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Jul 2026 03:52:03 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/6526.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 07 Feb 2018 02:20:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to fs.stat  SyntaxError: Unexpected token on Wed, 07 Feb 2018 17:47:33 GMT]]></title><description><![CDATA[<p dir="auto">Yes, I had imported it with    <code>const fs = require ('fs');</code><br />
but I was not creating the function well in the right place. Thank you.<br />
It’s crazy what I want, I know. I want to connect <strong>Kalliope</strong> (modular always-on voice controlled personal assistant) - <a href="https://kalliope-project.github.io" target="_blank" rel="noopener noreferrer nofollow ugc">https://kalliope-project.github.io</a> with MagicMirror. I find it a very powerful and flexible tool. The program I already manage it well separately and I have created “neurons” and “events” … etc, but it would be wonderful to interact with MagicMirror modules.<br />
Lights, sensors, temperature, webcam, notifications, reading email, music … etc, that I already have it integrated in Kalliope</p>
]]></description><link>https://forum.magicmirror.builders/post/35360</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/35360</guid><dc:creator><![CDATA[pepebc]]></dc:creator><pubDate>Wed, 07 Feb 2018 17:47:33 GMT</pubDate></item><item><title><![CDATA[Reply to fs.stat  SyntaxError: Unexpected token on Wed, 07 Feb 2018 16:17:25 GMT]]></title><description><![CDATA[<p dir="auto">It may be included by default in Node.js, but you <a href="https://www.w3schools.com/nodejs/nodejs_filesystem.asp" target="_blank" rel="noopener noreferrer nofollow ugc">still need to import it into your script</a>.</p>
]]></description><link>https://forum.magicmirror.builders/post/35357</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/35357</guid><dc:creator><![CDATA[ninjabreadman]]></dc:creator><pubDate>Wed, 07 Feb 2018 16:17:25 GMT</pubDate></item><item><title><![CDATA[Reply to fs.stat  SyntaxError: Unexpected token on Wed, 07 Feb 2018 15:20:34 GMT]]></title><description><![CDATA[<p dir="auto">fs is included by default in nmp.<br />
I do tests because I need to verify that a text file exists in the module directory when an attempt was made to create.<br />
I am not an expert in programming and I am trying with the functions that I find online. Always it gives me that error, although in the forums seems to work. In this environment, it gives me problems.</p>
]]></description><link>https://forum.magicmirror.builders/post/35353</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/35353</guid><dc:creator><![CDATA[pepebc]]></dc:creator><pubDate>Wed, 07 Feb 2018 15:20:34 GMT</pubDate></item><item><title><![CDATA[Reply to fs.stat  SyntaxError: Unexpected token on Wed, 07 Feb 2018 06:12:02 GMT]]></title><description><![CDATA[<p dir="auto">Also did you import the fs module correctly?</p>
]]></description><link>https://forum.magicmirror.builders/post/35334</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/35334</guid><dc:creator><![CDATA[strawberry 3.141]]></dc:creator><pubDate>Wed, 07 Feb 2018 06:12:02 GMT</pubDate></item><item><title><![CDATA[Reply to fs.stat  SyntaxError: Unexpected token on Wed, 07 Feb 2018 03:02:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/pepebc" aria-label="Profile: pepebc">@<bdi>pepebc</bdi></a> It may depend on what precedes that snippet (if anything). Try copy/pasting the whole file into <a href="http://jshint.com" target="_blank" rel="noopener noreferrer nofollow ugc">JSHint</a>, it may give you a better idea. Also, doesn’t <code>fs.stat()</code> take a <code>path</code> as <a href="https://nodejs.org/api/fs.html#fs_fs_stat_path_callback" target="_blank" rel="noopener noreferrer nofollow ugc">the first argument</a>?</p>
]]></description><link>https://forum.magicmirror.builders/post/35332</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/35332</guid><dc:creator><![CDATA[ninjabreadman]]></dc:creator><pubDate>Wed, 07 Feb 2018 03:02:09 GMT</pubDate></item></channel></rss>