The behavior of the example below is very odd. Every file name suffix I've tried works -- except for .js! I've tested this on Windows, but not Linux. The behavior is the same whether run under TeXworks or with cygwin and pdflatex. It feels like a problem with Windows, but it's hard to see how.
\documentclass[10pt]{article}
\usepackage{xsim}
\ExplSyntaxOn
\NewDocumentEnvironment{intfig} { > { \SplitArgument { 1 } { , } } m!o }
{
% This will not work. The error is
% I can't write on file 'blather.js'
%\str_set:Nn \l_intfig_jinfile_str { blather.js }
% But this works!
\str_set:Nn \l_intfig_jinfile_str { blather.xyz }
\xsim_file_write_start:nn { \c_false_bool } \l_intfig_jinfile_str
}
{
\xsim_file_write_stop:
}
\ExplSyntaxOff
\begin{document}
Here it comes
\begin{intfig}
test test test
\end{intfig}
There it goes
\end{document}
In some ways, this is a follow-up to the question I asked here: Saving the body of an environment to a file verbatim using xparse
Also, even with an acceptable file suffix, the first character of the body is omitted in the saved file.