You can use AFilesB for this. For example:
will places the first 1000 bytes of the JPG files into a list L1.
stuff some time ago, which worked out very well in the end. Below is some of the code I currently use (created with help from others as shown in linked thread):
Code:
WriteBase64(fname)
BEGIN
LOCAL fcontent,j,b64str:="",fsize,fiter;
fsize:=AFilesB(fname);
IF fsize>9998 THEN // lists can not be longer than 10000, 9999 divides by 3 evenly
fiter:=IP(fsize/9999);
FOR j FROM 1 TO fiter DO
fcontent:=AFilesB(fname,(j-1)*9999,9999);
b64str:=b64str+Base64String(9999,fcontent);
END;
IF FP(fsize/9999) THEN
fcontent:=AFilesB(fname,fiter*9999,fsize-(fiter*9999));
b64str:=b64str+Base64String(SIZE(fcontent),fcontent);
END;
ELSE
fcontent:=AFilesB(fname,0,fsize);
b64str:=b64str+Base64String(SIZE(fcontent),fcontent);
END;
RETURN b64str;
END;
Base64String(fsize,mylst)
BEGIN
LOCAL fiter:=IP(fsize/3),L1,N,j,i,mystr:="";
LOCAL dict:={"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"};
FOR j FROM 1 TO fiter DO
N:=mylst(j*3-2)*256^2+mylst(j*3-1)*256+mylst(j*3);
FOR i FROM 3 DOWNTO 0 DO
L1:=IP(N/64^i);
mystr:=mystr+dict(L1+1);
N:=N-L1*64^i;
END;
END;
IF fsize-fiter*3 THEN // fractional
IF (fsize-fiter*3)==1 THEN
N:=mylst(fsize)*256^2;
FOR i FROM 3 DOWNTO 2 DO
L1:=IP(N/64^i);
mystr:=mystr+dict(L1+1);
N:=N-L1*64^i;
END;
mystr:=mystr+"==";
ELSE // must be 2
N:=mylst(fsize-1)*256^2+mylst(fsize)*256;
FOR i FROM 3 DOWNTO 1 DO
L1:=IP(N/64^i);
mystr:=mystr+dict(L1+1);
N:=N-L1*64^i;
END;
mystr:=mystr+"=";
END;
END;
RETURN mystr;
END;
Maybe not quite the usage in mind, but some clues hopefully in there somewhere.