We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Description: At the moment, when we need to read a remote file content, we have to something like below.
service on remoteServer { remote function onFileChange(ftp:WatchEvent & readonly fileEvent, ftp:Caller caller) { foreach ftp:FileInfo addedFile in fileEvent.addedFiles { stream<byte[] & readonly, io:Error?> fileStream = check caller->get(addedFile.path); json|error j = fromBytesToJson(fileStream); io:println(j); } } } function fromBytesToJson(stream<byte[] & readonly, io:Error?> fileStream) returns json|error { byte[] bytes = []; check fileStream.forEach(function(byte[] & readonly block) { bytes.push(...block); }); string s = check string:fromBytes(bytes); json j = check s.fromJsonString(); return j; }
Rather than this, its better to have something as follows.
json jsonContent = check caller->get(addedFile.path); csv csvContent = check caller->get(addedFile.path); xml xmlContent = check caller->get(addedFile.path); byte[] byteContent = check caller->get(addedFile.path);
The text was updated successfully, but these errors were encountered:
We can also support a list of a record types etc.
Person[] person = check caller->get(addedFile.path);
Sorry, something went wrong.
NipunaRanasinghe
No branches or pull requests
Description:
At the moment, when we need to read a remote file content, we have to something like below.
Rather than this, its better to have something as follows.
The text was updated successfully, but these errors were encountered: