1
Meteor.methods({
'parseFile'() {
Papa.parse('/private/file/buildingData.csv', {
download: true,
complete: function(results) {
console.log("hi there how are you")
console.log(results); // array of rows
return results;
}
});
}
})
上記のメソッドは、メソッド名builderData.jsファイルのmethodsという名前のフォルダーに定義されています。そして、私はこのメソッドを、以下のコードを使ってmap.onRendered()の下のクライアントから呼び出しています。Meteorサーバー側のメソッド呼び出し
Meteor.call('parseFile', (err, res) => {
if (err) {
alert(err);
} else {
// success!
}
});
私は、それゆえ私はhtmlコードでpapaparse.jsを含めるようにスクリプトタグを使用する必要はありません流星meteor add harrison:papa-parse
をしました。以下のコメントをもとに
今私は、サーバー側ではなく、次のエラーでデータを印刷することができる午前:
{ data: [ [ '/private/file/buildingData.csv' ] ],
I20160905-12:22:03.973(10)? errors:
I20160905-12:22:03.974(10)? [ { type: 'Delimiter',
I20160905-12:22:03.974(10)? code: 'UndetectableDelimiter',
I20160905-12:22:03.975(10)? message: 'Unable to auto-detect delimiting character; defaulted to
\',\'',
I20160905-12:22:03.976(10)? row: undefined } ],
I20160905-12:22:03.977(10)? meta:
I20160905-12:22:03.978(10)? { delimiter: ',',
I20160905-12:22:03.978(10)? linebreak: '\n',
I20160905-12:22:03.979(10)? aborted: false,
I20160905-12:22:03.979(10)? truncated: false } }
I20160905-12:22:03.986(10)? hi there how are you
I20160905-12:22:03.987(10)? { data: [ [ '/private/file/buildingData.csv' ] ],
I20160905-12:22:03.988(10)? errors:
I20160905-12:22:03.989(10)? [ { type: 'Delimiter',
I20160905-12:22:03.990(10)? code: 'UndetectableDelimiter',
I20160905-12:22:03.990(10)? message: 'Unable to auto-detect delimiting character; defaulted to
\',\'',
I20160905-12:22:03.991(10)? row: undefined } ],
I20160905-12:22:03.992(10)? meta:
I20160905-12:22:03.992(10)? { delimiter: ',',
I20160905-12:22:03.993(10)? linebreak: '\n',
I20160905-12:22:03.999(10)? aborted: false,
I20160905-12:22:03.999(10)? truncated: false } }
I20160905-12:22:04.000(10)? Retrieving current observations...
I20160905-12:22:05.329(10)? finishing
I20160905-12:22:05.330(10)? Retrieving hourly forecast...
I20160905-12:22:06.383(10)? finishing
I20160905-12:22:06.384(10)? Retrieving daily forecast...
I20160905-12:22:07.592(10)? finishing
I20160905-12:22:07.593(10)? hi there how are you
I20160905-12:22:07.593(10)? { data: [ [ '/private/file/buildingData.csv' ] ],
I20160905-12:22:07.594(10)? errors:
I20160905-12:22:07.594(10)? [ { type: 'Delimiter',
I20160905-12:22:07.594(10)? code: 'UndetectableDelimiter',
I20160905-12:22:07.594(10)? message: 'Unable to auto-detect delimiting character; defaulted to
\',\'',
I20160905-12:22:07.595(10)? row: undefined } ],
I20160905-12:22:07.595(10)? meta:
I20160905-12:22:07.596(10)? { delimiter: ',',
I20160905-12:22:07.596(10)? linebreak: '\n',
I20160905-12:22:07.596(10)? aborted: false,
I20160905-12:22:07.597(10)? truncated: false } }
I20160905-12:22:07.598(10)? hi there how are you
I20160905-12:22:07.600(10)? { data: [ [ '/private/file/buildingData.csv' ] ],
I20160905-12:22:07.601(10)? errors:
I20160905-12:22:07.601(10)? [ { type: 'Delimiter',
I20160905-12:22:07.602(10)? code: 'UndetectableDelimiter',
I20160905-12:22:07.602(10)? message: 'Unable to auto-detect delimiting character; defaulted to
\',\'',
I20160905-12:22:07.602(10)? row: undefined } ],
は公式ドキュメントです:のhttp:// papaparse.com/docs – Mussser