I/O on Swish

I tryed to publish my work on the Swish platform, but all the main procedures require to write the output in a file, but here it’s not allowed.
This is the latest version of an expert system for automated rule-based generation of music. The program works in time lapsed and produce as output a playable standard MIDI file. If I can’t open an output stream the program is unusable.
How can I do?

In a previous topic you made your code available for download. Is this still the same code or similar enough that it represents your problem?

music_eng.pl (31,1 KB) (SWI-Prolog 64 bit release 8.0.3)

As I do not use SWISH other than for checking out existing work published there I can not help.

Have you considered publishing your work as an SWI-Prolog pack?

Note: SWI-Prolog packs should not be confused with SWI-Prolog packages. Be aware that the wrong word (pack or package) may be used and then the correct word has to be derived from context.

Yes. My previous code represent the problem, although the current code is much better than the previous one.

Writing to a file won’t help too much as it would end up on the server … SWISH isn’t really designed to generate arbitrary files. It can generate CSV and image files, but that is about it. There may be a way. The idea would be to use its HTML output capabilities and generate a button with a data URL as href.

The idea would be to use with_output_to/2 to generate a string containing the wiki document and then encode it to form a data url. Not sure it works as-is given the various limitations of SWISH. Would it be enough for you?