Controlled I/O for JavaScript