consoledemo.lpr 880 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. program consoledemo;
  2. {$mode objfpc}
  3. {$R help.txt}
  4. uses
  5. types, p2jsres, nodejs;
  6. Var
  7. RL : TStringDynArray;
  8. S : String;
  9. aInfo : TResourceInfo;
  10. begin
  11. Writeln('Javascript source:');
  12. SetResourceSource(rsJS);
  13. RL:=GetResourceNames;
  14. For S in RL do
  15. begin
  16. Writeln('--- Found resource ',S,' : ');
  17. if not GetResourceInfo(S,aInfo) then
  18. Writeln('No extra information for resource ',S,' available')
  19. else
  20. begin
  21. Writeln('Name: ',aInfo.Name);
  22. Writeln('Format: ',aInfo.Format);
  23. Writeln('encoding: ',aInfo.Encoding);
  24. Writeln('unit: ',aInfo.resourceunit);
  25. Writeln('data length: ',Length(aInfo.data));
  26. end;
  27. end;
  28. if not GetResourceInfo('help',aInfo) then
  29. Writeln('resource help not found !')
  30. else
  31. begin
  32. Writeln('Usage:');
  33. Writeln(TNJSBuffer.from(ainfo.Data,'base64').toString);
  34. end;
  35. end.