• file_copy()

    From Mortifis@VERT/ALLEYCAT to All on Sat Feb 29 07:45:11 2020
    moding /sbbs/exec/load/openweathermap.js to copy the /sbbs/temp/{response}.jsonãfile but it isn't working ...ããOpenWeatherMap.prototype.write_cache = function (endpoint, params, response) {ã const hash = base64_encode(endpoint + JSON.stringify(params));ã cache_file = new File(system.temp_dir + 'openweathermap_' + hash +ã'.json');ã cache_file.open('w');ã cache_file.write(JSON.stringify(response));ã cache_file.close();ã--> file_copy(cache_file, '/sbbs/etrucker/' + 'owm.json'); ã writeln('Copied '+cache_file + 'to /sbbs/etrucker.owm.json');ã}ããthe file_copy(cache_file, '/sbbs/etrucker/' + 'owm.json'); seems to errorããany ideas?ãã---ã þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81ã
  • From Digital Man@VERT to Mortifis on Sat Feb 29 12:47:15 2020
    Re: file_copy()ã By: Mortifis to All on Sat Feb 29 2020 07:45 amãã > moding /sbbs/exec/load/openweathermap.js to copy theã > /sbbs/temp/{response}.json file but it isn't working ...ã >ã > OpenWeatherMap.prototype.write_cache = function (endpoint, params, response)ã > {ã > const hash = base64_encode(endpoint + JSON.stringify(params));ã > cache_file = new File(system.temp_dir + 'openweathermap_' + hash +ã > '.json');ã > cache_file.open('w');ã > cache_file.write(JSON.stringify(response));ã > cache_file.close();ã > --> file_copy(cache_file, '/sbbs/etrucker/' + 'owm.json');ã > writeln('Copied '+cache_file + 'to /sbbs/etrucker.owm.json');ã > }ã >ã > the file_copy(cache_file, '/sbbs/etrucker/' + 'owm.json'); seems to errorã >ã > any ideas?ããcache_file is a File object. The file_copy() method requires strings (filenames) for arguments.ããSo I think you want:ã file_copy(cache_file.name, '/sbbs/etrucker/owm.json');ãinstead.ããAlso, check the return value of file_copy() to see if the copy was successful or not.ãã digital manããThis Is Spinal Tap quote #32:ãDerek Smalls: [A jog?] We don't have time for that.ãNorco, CA WX: 70.2øF, 27.0% humidity, 0 mph NW wind, 0.00 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã